var t = require("../../@babel/runtime/helpers/typeof");
!(function (s, i) {
  "object" == ("undefined" == typeof exports ? "undefined" : t(exports)) &&
  "undefined" != typeof module
    ? (module.exports = i())
    : "function" == typeof define && define.amd
      ? define(i)
      : ((void 0).proj4 = i());
})(0, function () {
  function s(t, s) {
    if (t[s]) return t[s];
    for (
      var i, a = Object.keys(t), h = s.toLowerCase().replace(Q, ""), e = -1;
      ++e < a.length;

    )
      if ((i = a[e]).toLowerCase().replace(Q, "") === h) return t[i];
  }
  function i(t) {
    if ("string" != typeof t) throw new Error("not a string");
    (this.text = t.trim()),
      (this.level = 0),
      (this.place = 0),
      (this.root = null),
      (this.stack = []),
      (this.currentObject = null),
      (this.state = H);
  }
  function a(t) {
    return new i(t).output();
  }
  function h(t, s, i) {
    Array.isArray(s) && (i.unshift(s), (s = null));
    var a = s ? {} : t,
      h = i.reduce(function (t, s) {
        return e(s, t), t;
      }, a);
    s && (t[s] = h);
  }
  function e(t, s) {
    if (Array.isArray(t)) {
      var i,
        a = t.shift();
      if (("PARAMETER" === a && (a = t.shift()), 1 === t.length))
        return Array.isArray(t[0])
          ? ((s[a] = {}), void e(t[0], s[a]))
          : void (s[a] = t[0]);
      if (t.length)
        if ("TOWGS84" !== a)
          switch ((Array.isArray(a) || (s[a] = {}), a)) {
            case "UNIT":
            case "PRIMEM":
            case "VERT_DATUM":
              return (
                (s[a] = { name: t[0].toLowerCase(), convert: t[1] }),
                void (3 === t.length && e(t[2], s[a]))
              );
            case "SPHEROID":
            case "ELLIPSOID":
              return (
                (s[a] = { name: t[0], a: t[1], rf: t[2] }),
                void (4 === t.length && e(t[3], s[a]))
              );
            case "PROJECTEDCRS":
            case "PROJCRS":
            case "GEOGCS":
            case "GEOCCS":
            case "PROJCS":
            case "LOCAL_CS":
            case "GEODCRS":
            case "GEODETICCRS":
            case "GEODETICDATUM":
            case "EDATUM":
            case "ENGINEERINGDATUM":
            case "VERT_CS":
            case "VERTCRS":
            case "VERTICALCRS":
            case "COMPD_CS":
            case "COMPOUNDCRS":
            case "ENGINEERINGCRS":
            case "ENGCRS":
            case "FITTED_CS":
            case "LOCAL_DATUM":
            case "DATUM":
              return (t[0] = ["name", t[0]]), void h(s, a, t);
            default:
              for (i = -1; ++i < t.length; )
                if (!Array.isArray(t[i])) return e(t, s[a]);
              return h(s, a, t);
          }
        else s[a] = t;
      else s[a] = !0;
    } else s[t] = !0;
  }
  function n(t) {
    return t * Y;
  }
  function r(s) {
    function i(t) {
      return t * (s.to_meter || 1);
    }
    "GEOGCS" === s.type
      ? (s.projName = "longlat")
      : "LOCAL_CS" === s.type
        ? ((s.projName = "identity"), (s.local = !0))
        : "object" == t(s.PROJECTION)
          ? (s.projName = Object.keys(s.PROJECTION)[0])
          : (s.projName = s.PROJECTION),
      s.UNIT &&
        ((s.units = s.UNIT.name.toLowerCase()),
        "metre" === s.units && (s.units = "meter"),
        s.UNIT.convert &&
          ("GEOGCS" === s.type
            ? s.DATUM &&
              s.DATUM.SPHEROID &&
              (s.to_meter = s.UNIT.convert * s.DATUM.SPHEROID.a)
            : (s.to_meter = s.UNIT.convert)));
    var a = s.GEOGCS;
    "GEOGCS" === s.type && (a = s),
      a &&
        (a.DATUM
          ? (s.datumCode = a.DATUM.name.toLowerCase())
          : (s.datumCode = a.name.toLowerCase()),
        "d_" === s.datumCode.slice(0, 2) &&
          (s.datumCode = s.datumCode.slice(2)),
        ("new_zealand_geodetic_datum_1949" !== s.datumCode &&
          "new_zealand_1949" !== s.datumCode) ||
          (s.datumCode = "nzgd49"),
        "wgs_1984" === s.datumCode &&
          ("Mercator_Auxiliary_Sphere" === s.PROJECTION && (s.sphere = !0),
          (s.datumCode = "wgs84")),
        "_ferro" === s.datumCode.slice(-6) &&
          (s.datumCode = s.datumCode.slice(0, -6)),
        "_jakarta" === s.datumCode.slice(-8) &&
          (s.datumCode = s.datumCode.slice(0, -8)),
        ~s.datumCode.indexOf("belge") && (s.datumCode = "rnb72"),
        a.DATUM &&
          a.DATUM.SPHEROID &&
          ((s.ellps = a.DATUM.SPHEROID.name
            .replace("_19", "")
            .replace(/[Cc]larke\_18/, "clrk")),
          "international" === s.ellps.toLowerCase().slice(0, 13) &&
            (s.ellps = "intl"),
          (s.a = a.DATUM.SPHEROID.a),
          (s.rf = parseFloat(a.DATUM.SPHEROID.rf, 10))),
        ~s.datumCode.indexOf("osgb_1936") && (s.datumCode = "osgb36")),
      s.b && !isFinite(s.b) && (s.b = s.a);
    [
      ["standard_parallel_1", "Standard_Parallel_1"],
      ["standard_parallel_2", "Standard_Parallel_2"],
      ["false_easting", "False_Easting"],
      ["false_northing", "False_Northing"],
      ["central_meridian", "Central_Meridian"],
      ["latitude_of_origin", "Latitude_Of_Origin"],
      ["latitude_of_origin", "Central_Parallel"],
      ["scale_factor", "Scale_Factor"],
      ["k0", "scale_factor"],
      ["latitude_of_center", "Latitude_of_center"],
      ["lat0", "latitude_of_center", n],
      ["longitude_of_center", "Longitude_Of_Center"],
      ["longc", "longitude_of_center", n],
      ["x0", "false_easting", i],
      ["y0", "false_northing", i],
      ["long0", "central_meridian", n],
      ["lat0", "latitude_of_origin", n],
      ["lat0", "standard_parallel_1", n],
      ["lat1", "standard_parallel_1", n],
      ["lat2", "standard_parallel_2", n],
      ["alpha", "azimuth", n],
      ["srsCode", "name"],
    ].forEach(function (t) {
      return (function (t, s) {
        var i = s[0],
          a = s[1];
        !(i in t) &&
          a in t &&
          ((t[i] = t[a]), 3 === s.length && (t[i] = s[2](t[i])));
      })(s, t);
    }),
      s.long0 ||
        !s.longc ||
        ("Albers_Conic_Equal_Area" !== s.projName &&
          "Lambert_Azimuthal_Equal_Area" !== s.projName) ||
        (s.long0 = s.longc),
      s.lat_ts ||
        !s.lat1 ||
        ("Stereographic_South_Pole" !== s.projName &&
          "Polar Stereographic (variant B)" !== s.projName) ||
        ((s.lat0 = n(s.lat1 > 0 ? 90 : -90)), (s.lat_ts = s.lat1));
  }
  function o(t) {
    var s = this;
    if (2 === arguments.length) {
      var i = arguments[1];
      "string" == typeof i
        ? "+" === i.charAt(0)
          ? (o[t] = W(arguments[1]))
          : (o[t] = $(arguments[1]))
        : (o[t] = i);
    } else if (1 === arguments.length) {
      if (Array.isArray(t))
        return t.map(function (t) {
          Array.isArray(t) ? o.apply(s, t) : o(t);
        });
      if ("string" == typeof t) {
        if (t in o) return o[t];
      } else
        "EPSG" in t
          ? (o["EPSG:" + t.EPSG] = t)
          : "ESRI" in t
            ? (o["ESRI:" + t.ESRI] = t)
            : "IAU2000" in t
              ? (o["IAU2000:" + t.IAU2000] = t)
              : console.log(t);
      return;
    }
  }
  function l(t) {
    return (function (t) {
      return "string" == typeof t;
    })(t)
      ? (function (t) {
          return t in o;
        })(t)
        ? o[t]
        : (function (t) {
              return tt.some(function (s) {
                return t.indexOf(s) > -1;
              });
            })(t)
          ? $(t)
          : (function (t) {
                return "+" === t[0];
              })(t)
            ? W(t)
            : void 0
      : t;
  }
  function M(t) {
    return t;
  }
  function c(t, s) {
    var i = lt.length;
    return t.names
      ? ((lt[i] = t),
        t.names.forEach(function (t) {
          ot[t.toLowerCase()] = i;
        }),
        this)
      : (console.log(s), !0);
  }
  function u(i, a) {
    if (!(this instanceof u)) return new u(i);
    a =
      a ||
      function (t) {
        if (t) throw t;
      };
    var h = l(i);
    if ("object" == t(h)) {
      var e = u.projections.get(h.projName);
      if (e) {
        if (h.datumCode && "none" !== h.datumCode) {
          var n = s(ft, h.datumCode);
          n &&
            ((h.datum_params = n.towgs84 ? n.towgs84.split(",") : null),
            (h.ellps = n.ellipse),
            (h.datumName = n.datumName ? n.datumName : h.datumCode));
        }
        (h.k0 = h.k0 || 1),
          (h.axis = h.axis || "enu"),
          (h.ellps = h.ellps || "wgs84");
        var r = (function (t, i, a, h, e) {
            if (!t) {
              var n = s(ct, h);
              n || (n = ut), (t = n.a), (i = n.b), (a = n.rf);
            }
            return (
              a && !i && (i = (1 - 1 / a) * t),
              (0 === a || Math.abs(t - i) < L) && ((e = !0), (i = t)),
              { a: t, b: i, rf: a, sphere: e }
            );
          })(h.a, h.b, h.rf, h.ellps, h.sphere),
          o = (function (t, s, i, a) {
            var h = t * t,
              e = s * s,
              n = (h - e) / h,
              r = 0;
            return (
              a
                ? ((h = (t *= 1 - n * (G + n * (j + n * R))) * t), (n = 0))
                : (r = Math.sqrt(n)),
              { es: n, e: r, ep2: (h - e) / e }
            );
          })(r.a, r.b, r.rf, h.R_A),
          M =
            h.datum ||
            (function (t, s, i, a, h, e) {
              var n = {};
              return (
                (n.datum_type = void 0 === t || "none" === t ? I : q),
                s &&
                  ((n.datum_params = s.map(parseFloat)),
                  (0 === n.datum_params[0] &&
                    0 === n.datum_params[1] &&
                    0 === n.datum_params[2]) ||
                    (n.datum_type = k),
                  n.datum_params.length > 3 &&
                    ((0 === n.datum_params[3] &&
                      0 === n.datum_params[4] &&
                      0 === n.datum_params[5] &&
                      0 === n.datum_params[6]) ||
                      ((n.datum_type = E),
                      (n.datum_params[3] *= A),
                      (n.datum_params[4] *= A),
                      (n.datum_params[5] *= A),
                      (n.datum_params[6] = n.datum_params[6] / 1e6 + 1)))),
                (n.a = i),
                (n.b = a),
                (n.es = h),
                (n.ep2 = e),
                n
              );
            })(h.datumCode, h.datum_params, r.a, r.b, o.es, o.ep2);
        st(this, h),
          st(this, e),
          (this.a = r.a),
          (this.b = r.b),
          (this.rf = r.rf),
          (this.sphere = r.sphere),
          (this.es = o.es),
          (this.e = o.e),
          (this.ep2 = o.ep2),
          (this.datum = M),
          this.init(),
          a(null, this);
      } else a(i);
    } else a(i);
  }
  function f(t) {
    return t === k || t === E;
  }
  function p(t, s, i) {
    var a;
    return (
      Array.isArray(i) && (i = dt(i)),
      t.datum &&
        s.datum &&
        (function (t, s) {
          return (
            ((t.datum.datum_type === k || t.datum.datum_type === E) &&
              "WGS84" !== s.datumCode) ||
            ((s.datum.datum_type === k || s.datum.datum_type === E) &&
              "WGS84" !== t.datumCode)
          );
        })(t, s) &&
        ((i = p(t, (a = new u("WGS84")), i)), (t = a)),
      "enu" !== t.axis && (i = mt(t, !1, i)),
      "longlat" === t.projName
        ? (i = { x: i.x * z, y: i.y * z })
        : (t.to_meter && (i = { x: i.x * t.to_meter, y: i.y * t.to_meter }),
          (i = t.inverse(i))),
      t.from_greenwich && (i.x += t.from_greenwich),
      (i = pt(t.datum, s.datum, i)),
      s.from_greenwich && (i = { x: i.x - s.from_greenwich, y: i.y }),
      "longlat" === s.projName
        ? (i = { x: i.x * T, y: i.y * T })
        : ((i = s.forward(i)),
          s.to_meter && (i = { x: i.x / s.to_meter, y: i.y / s.to_meter })),
      "enu" !== s.axis ? mt(s, !0, i) : i
    );
  }
  function m(t, s, i) {
    var a;
    return Array.isArray(i)
      ? ((a = p(t, s, i)), 3 === i.length ? [a.x, a.y, a.z] : [a.x, a.y])
      : p(t, s, i);
  }
  function d(t) {
    return t instanceof u ? t : t.oProj ? t.oProj : u(t);
  }
  function y(t, s, i) {
    t = d(t);
    var a,
      h = !1;
    return (
      void 0 === s
        ? ((s = t), (t = yt), (h = !0))
        : (void 0 !== s.x || Array.isArray(s)) &&
          ((i = s), (s = t), (t = yt), (h = !0)),
      (s = d(s)),
      i
        ? m(t, s, i)
        : ((a = {
            forward: function (i) {
              return m(t, s, i);
            },
            inverse: function (i) {
              return m(s, t, i);
            },
          }),
          h && (a.oProj = s),
          a)
    );
  }
  function _(t, s) {
    return (
      (s = s || 5),
      (function (t, s) {
        var i = "00000" + t.easting,
          a = "00000" + t.northing;
        return (
          t.zoneNumber +
          t.zoneLetter +
          (function (t, s, i) {
            var a = C(i),
              h = Math.floor(t / 1e5),
              e = Math.floor(s / 1e5) % 20;
            return (function (t, s, i) {
              var a = i - 1,
                h = xt.charCodeAt(a),
                e = gt.charCodeAt(a),
                n = h + t - 1,
                r = e + s,
                o = !1;
              return (
                n > Pt && ((n = n - Pt + bt - 1), (o = !0)),
                (n === vt || (h < vt && n > vt) || ((n > vt || h < vt) && o)) &&
                  n++,
                (n === wt || (h < wt && n > wt) || ((n > wt || h < wt) && o)) &&
                  ++n === vt &&
                  n++,
                n > Pt && (n = n - Pt + bt - 1),
                r > Ct ? ((r = r - Ct + bt - 1), (o = !0)) : (o = !1),
                (r === vt || (e < vt && r > vt) || ((r > vt || e < vt) && o)) &&
                  r++,
                (r === wt || (e < wt && r > wt) || ((r > wt || e < wt) && o)) &&
                  ++r === vt &&
                  r++,
                r > Ct && (r = r - Ct + bt - 1),
                String.fromCharCode(n) + String.fromCharCode(r)
              );
            })(h, e, a);
          })(t.easting, t.northing, t.zoneNumber) +
          i.substr(i.length - 5, s) +
          a.substr(a.length - 5, s)
        );
      })(
        (function (t) {
          var s,
            i,
            a,
            h,
            e,
            n,
            r,
            o,
            l = t.lat,
            M = t.lon,
            c = 6378137,
            u = 0.00669438,
            f = 0.9996,
            p = g(l),
            m = g(M);
          (o = Math.floor((M + 180) / 6) + 1),
            180 === M && (o = 60),
            l >= 56 && l < 64 && M >= 3 && M < 12 && (o = 32),
            l >= 72 &&
              l < 84 &&
              (M >= 0 && M < 9
                ? (o = 31)
                : M >= 9 && M < 21
                  ? (o = 33)
                  : M >= 21 && M < 33
                    ? (o = 35)
                    : M >= 33 && M < 42 && (o = 37)),
            (r = g(6 * (o - 1) - 180 + 3)),
            (s = u / (1 - u)),
            (i = c / Math.sqrt(1 - u * Math.sin(p) * Math.sin(p))),
            (a = Math.tan(p) * Math.tan(p)),
            (h = s * Math.cos(p) * Math.cos(p)),
            (e = Math.cos(p) * (m - r)),
            (n =
              c *
              (0.9983242984503243 * p -
                0.002514607064228144 * Math.sin(2 * p) +
                2639046602129982e-21 * Math.sin(4 * p) -
                ((35 * u * u * u) / 3072) * Math.sin(6 * p)));
          var d =
              f *
                i *
                (e +
                  ((1 - a + h) * e * e * e) / 6 +
                  ((5 - 18 * a + a * a + 72 * h - 58 * s) * e * e * e * e * e) /
                    120) +
              5e5,
            y =
              f *
              (n +
                i *
                  Math.tan(p) *
                  ((e * e) / 2 +
                    ((5 - a + 9 * h + 4 * h * h) * e * e * e * e) / 24 +
                    ((61 - 58 * a + a * a + 600 * h - 330 * s) *
                      e *
                      e *
                      e *
                      e *
                      e *
                      e) /
                      720));
          return (
            l < 0 && (y += 1e7),
            {
              northing: Math.round(y),
              easting: Math.round(d),
              zoneNumber: o,
              zoneLetter: w(l),
            }
          );
        })({ lat: t[1], lon: t[0] }),
        s,
      )
    );
  }
  function x(t) {
    var s = v(P(t.toUpperCase()));
    return s.lat && s.lon
      ? [s.lon, s.lat]
      : [(s.left + s.right) / 2, (s.top + s.bottom) / 2];
  }
  function g(t) {
    return t * (Math.PI / 180);
  }
  function b(t) {
    return (t / Math.PI) * 180;
  }
  function v(t) {
    var s = t.northing,
      i = t.easting,
      a = t.zoneLetter,
      h = t.zoneNumber;
    if (h < 0 || h > 60) return null;
    var e,
      n,
      r,
      o,
      l,
      M,
      c,
      u,
      f,
      p = 0.9996,
      m = 6378137,
      d = 0.00669438,
      y = (1 - Math.sqrt(1 - d)) / (1 + Math.sqrt(1 - d)),
      _ = i - 5e5,
      x = s;
    a < "N" && (x -= 1e7),
      (c = 6 * (h - 1) - 180 + 3),
      (e = d / (1 - d)),
      (f =
        (u = x / p / 6367449.145945056) +
        ((3 * y) / 2 - (27 * y * y * y) / 32) * Math.sin(2 * u) +
        ((21 * y * y) / 16 - (55 * y * y * y * y) / 32) * Math.sin(4 * u) +
        ((151 * y * y * y) / 96) * Math.sin(6 * u)),
      (n = m / Math.sqrt(1 - d * Math.sin(f) * Math.sin(f))),
      (r = Math.tan(f) * Math.tan(f)),
      (o = e * Math.cos(f) * Math.cos(f)),
      (l = (m * (1 - d)) / Math.pow(1 - d * Math.sin(f) * Math.sin(f), 1.5)),
      (M = _ / (n * p));
    var g =
      f -
      ((n * Math.tan(f)) / l) *
        ((M * M) / 2 -
          ((5 + 3 * r + 10 * o - 4 * o * o - 9 * e) * M * M * M * M) / 24 +
          ((61 + 90 * r + 298 * o + 45 * r * r - 252 * e - 3 * o * o) *
            M *
            M *
            M *
            M *
            M *
            M) /
            720);
    g = b(g);
    var w,
      C =
        (M -
          ((1 + 2 * r + o) * M * M * M) / 6 +
          ((5 - 2 * o + 28 * r - 3 * o * o + 8 * e + 24 * r * r) *
            M *
            M *
            M *
            M *
            M) /
            120) /
        Math.cos(f);
    if (((C = c + b(C)), t.accuracy)) {
      var P = v({
        northing: t.northing + t.accuracy,
        easting: t.easting + t.accuracy,
        zoneLetter: t.zoneLetter,
        zoneNumber: t.zoneNumber,
      });
      w = { top: P.lat, right: P.lon, bottom: g, left: C };
    } else w = { lat: g, lon: C };
    return w;
  }
  function w(t) {
    var s = "Z";
    return (
      84 >= t && t >= 72
        ? (s = "X")
        : 72 > t && t >= 64
          ? (s = "W")
          : 64 > t && t >= 56
            ? (s = "V")
            : 56 > t && t >= 48
              ? (s = "U")
              : 48 > t && t >= 40
                ? (s = "T")
                : 40 > t && t >= 32
                  ? (s = "S")
                  : 32 > t && t >= 24
                    ? (s = "R")
                    : 24 > t && t >= 16
                      ? (s = "Q")
                      : 16 > t && t >= 8
                        ? (s = "P")
                        : 8 > t && t >= 0
                          ? (s = "N")
                          : 0 > t && t >= -8
                            ? (s = "M")
                            : -8 > t && t >= -16
                              ? (s = "L")
                              : -16 > t && t >= -24
                                ? (s = "K")
                                : -24 > t && t >= -32
                                  ? (s = "J")
                                  : -32 > t && t >= -40
                                    ? (s = "H")
                                    : -40 > t && t >= -48
                                      ? (s = "G")
                                      : -48 > t && t >= -56
                                        ? (s = "F")
                                        : -56 > t && t >= -64
                                          ? (s = "E")
                                          : -64 > t && t >= -72
                                            ? (s = "D")
                                            : -72 > t && t >= -80 && (s = "C"),
      s
    );
  }
  function C(t) {
    var s = t % _t;
    return 0 === s && (s = _t), s;
  }
  function P(t) {
    if (t && 0 === t.length) throw "MGRSPoint coverting from nothing";
    for (
      var s, i = t.length, a = null, h = "", e = 0;
      !/[A-Z]/.test((s = t.charAt(e)));

    ) {
      if (e >= 2) throw "MGRSPoint bad conversion from: " + t;
      (h += s), e++;
    }
    var n = parseInt(h, 10);
    if (0 === e || e + 3 > i) throw "MGRSPoint bad conversion from: " + t;
    var r = t.charAt(e++);
    if (
      r <= "A" ||
      "B" === r ||
      "Y" === r ||
      r >= "Z" ||
      "I" === r ||
      "O" === r
    )
      throw "MGRSPoint zone letter " + r + " not handled: " + t;
    a = t.substring(e, (e += 2));
    for (
      var o = C(n),
        l = (function (t, s) {
          for (
            var i = xt.charCodeAt(s - 1), a = 1e5, h = !1;
            i !== t.charCodeAt(0);

          ) {
            if ((++i === vt && i++, i === wt && i++, i > Pt)) {
              if (h) throw "Bad character: " + t;
              (i = bt), (h = !0);
            }
            a += 1e5;
          }
          return a;
        })(a.charAt(0), o),
        M = (function (t, s) {
          if (t > "V") throw "MGRSPoint given invalid Northing " + t;
          for (
            var i = gt.charCodeAt(s - 1), a = 0, h = !1;
            i !== t.charCodeAt(0);

          ) {
            if ((++i === vt && i++, i === wt && i++, i > Ct)) {
              if (h) throw "Bad character: " + t;
              (i = bt), (h = !0);
            }
            a += 1e5;
          }
          return a;
        })(a.charAt(1), o);
      M < N(r);

    )
      M += 2e6;
    var c = i - e;
    if (c % 2 != 0)
      throw (
        "MGRSPoint has to have an even number \nof digits after the zone letter and two 100km letters - front \nhalf for easting meters, second half for \nnorthing meters" +
        t
      );
    var u,
      f,
      p,
      m = c / 2,
      d = 0,
      y = 0;
    return (
      m > 0 &&
        ((u = 1e5 / Math.pow(10, m)),
        (f = t.substring(e, e + m)),
        (d = parseFloat(f) * u),
        (p = t.substring(e + m)),
        (y = parseFloat(p) * u)),
      {
        easting: d + l,
        northing: y + M,
        zoneLetter: r,
        zoneNumber: n,
        accuracy: u,
      }
    );
  }
  function N(t) {
    var s;
    switch (t) {
      case "C":
        s = 11e5;
        break;
      case "D":
        s = 2e6;
        break;
      case "E":
        s = 28e5;
        break;
      case "F":
        s = 37e5;
        break;
      case "G":
        s = 46e5;
        break;
      case "H":
        s = 55e5;
        break;
      case "J":
        s = 64e5;
        break;
      case "K":
        s = 73e5;
        break;
      case "L":
        s = 82e5;
        break;
      case "M":
        s = 91e5;
        break;
      case "N":
        s = 0;
        break;
      case "P":
        s = 8e5;
        break;
      case "Q":
        s = 17e5;
        break;
      case "R":
        s = 26e5;
        break;
      case "S":
        s = 35e5;
        break;
      case "T":
        s = 44e5;
        break;
      case "U":
        s = 53e5;
        break;
      case "V":
        s = 62e5;
        break;
      case "W":
        s = 7e6;
        break;
      case "X":
        s = 79e5;
        break;
      default:
        s = -1;
    }
    if (s >= 0) return s;
    throw "Invalid zone letter: " + t;
  }
  function S(s, i, a) {
    if (!(this instanceof S)) return new S(s, i, a);
    if (Array.isArray(s))
      (this.x = s[0]), (this.y = s[1]), (this.z = s[2] || 0);
    else if ("object" == t(s))
      (this.x = s.x), (this.y = s.y), (this.z = s.z || 0);
    else if ("string" == typeof s && void 0 === i) {
      var h = s.split(",");
      (this.x = parseFloat(h[0], 10)),
        (this.y = parseFloat(h[1], 10)),
        (this.z = parseFloat(h[2], 10) || 0);
    } else (this.x = s), (this.y = i), (this.z = a || 0);
    console.warn("proj4.Point will be removed in version 3, use proj4.toPoint");
  }
  var k = 1,
    E = 2,
    q = 4,
    I = 5,
    A = 484813681109536e-20,
    O = Math.PI / 2,
    G = 0.16666666666666666,
    j = 0.04722222222222222,
    R = 0.022156084656084655,
    L = void 0 === Number.EPSILON ? 1e-10 : Number.EPSILON,
    z = 0.017453292519943295,
    T = 57.29577951308232,
    D = Math.PI / 4,
    B = 2 * Math.PI,
    U = {
      greenwich: 0,
      lisbon: -9.131906111111,
      paris: 2.337229166667,
      bogota: -74.080916666667,
      madrid: -3.687938888889,
      rome: 12.452333333333,
      bern: 7.439583333333,
      jakarta: 106.807719444444,
      ferro: -17.666666666667,
      brussels: 4.367975,
      stockholm: 18.058277777778,
      athens: 23.7163375,
      oslo: 10.722916666667,
    },
    F = { ft: { to_meter: 0.3048 }, "us-ft": { to_meter: 1200 / 3937 } },
    Q = /[\s_\-\/\(\)]/g,
    W = function (t) {
      var i,
        a,
        h,
        e = {},
        n = t
          .split("+")
          .map(function (t) {
            return t.trim();
          })
          .filter(function (t) {
            return t;
          })
          .reduce(function (t, s) {
            var i = s.split("=");
            return i.push(!0), (t[i[0].toLowerCase()] = i[1]), t;
          }, {}),
        r = {
          proj: "projName",
          datum: "datumCode",
          rf: function (t) {
            e.rf = parseFloat(t);
          },
          lat_0: function (t) {
            e.lat0 = t * z;
          },
          lat_1: function (t) {
            e.lat1 = t * z;
          },
          lat_2: function (t) {
            e.lat2 = t * z;
          },
          lat_ts: function (t) {
            e.lat_ts = t * z;
          },
          lon_0: function (t) {
            e.long0 = t * z;
          },
          lon_1: function (t) {
            e.long1 = t * z;
          },
          lon_2: function (t) {
            e.long2 = t * z;
          },
          alpha: function (t) {
            e.alpha = parseFloat(t) * z;
          },
          lonc: function (t) {
            e.longc = t * z;
          },
          x_0: function (t) {
            e.x0 = parseFloat(t);
          },
          y_0: function (t) {
            e.y0 = parseFloat(t);
          },
          k_0: function (t) {
            e.k0 = parseFloat(t);
          },
          k: function (t) {
            e.k0 = parseFloat(t);
          },
          a: function (t) {
            e.a = parseFloat(t);
          },
          b: function (t) {
            e.b = parseFloat(t);
          },
          r_a: function () {
            e.R_A = !0;
          },
          zone: function (t) {
            e.zone = parseInt(t, 10);
          },
          south: function () {
            e.utmSouth = !0;
          },
          towgs84: function (t) {
            e.datum_params = t.split(",").map(function (t) {
              return parseFloat(t);
            });
          },
          to_meter: function (t) {
            e.to_meter = parseFloat(t);
          },
          units: function (t) {
            e.units = t;
            var i = s(F, t);
            i && (e.to_meter = i.to_meter);
          },
          from_greenwich: function (t) {
            e.from_greenwich = t * z;
          },
          pm: function (t) {
            var i = s(U, t);
            e.from_greenwich = (i || parseFloat(t)) * z;
          },
          nadgrids: function (t) {
            "@null" === t ? (e.datumCode = "none") : (e.nadgrids = t);
          },
          axis: function (t) {
            var s = "ewnsud";
            3 === t.length &&
              -1 !== s.indexOf(t.substr(0, 1)) &&
              -1 !== s.indexOf(t.substr(1, 1)) &&
              -1 !== s.indexOf(t.substr(2, 1)) &&
              (e.axis = t);
          },
        };
      for (i in n)
        (a = n[i]),
          i in r
            ? "function" == typeof (h = r[i])
              ? h(a)
              : (e[h] = a)
            : (e[i] = a);
      return (
        "string" == typeof e.datumCode &&
          "WGS84" !== e.datumCode &&
          (e.datumCode = e.datumCode.toLowerCase()),
        e
      );
    },
    H = 1,
    X = /\s/,
    J = /[A-Za-z]/,
    K = /[A-Za-z84]/,
    V = /[,\]]/,
    Z = /[\d\.E\-\+]/;
  (i.prototype.readCharicter = function () {
    var t = this.text[this.place++];
    if (4 !== this.state)
      for (; X.test(t); ) {
        if (this.place >= this.text.length) return;
        t = this.text[this.place++];
      }
    switch (this.state) {
      case H:
        return this.neutral(t);
      case 2:
        return this.keyword(t);
      case 4:
        return this.quoted(t);
      case 5:
        return this.afterquote(t);
      case 3:
        return this.number(t);
      case -1:
        return;
    }
  }),
    (i.prototype.afterquote = function (t) {
      if ('"' === t) return (this.word += '"'), void (this.state = 4);
      if (V.test(t))
        return (this.word = this.word.trim()), void this.afterItem(t);
      throw new Error(
        "havn't handled \"" + t + '" in afterquote yet, index ' + this.place,
      );
    }),
    (i.prototype.afterItem = function (t) {
      return "," === t
        ? (null !== this.word && this.currentObject.push(this.word),
          (this.word = null),
          void (this.state = H))
        : "]" === t
          ? (this.level--,
            null !== this.word &&
              (this.currentObject.push(this.word), (this.word = null)),
            (this.state = H),
            (this.currentObject = this.stack.pop()),
            void (this.currentObject || (this.state = -1)))
          : void 0;
    }),
    (i.prototype.number = function (t) {
      if (!Z.test(t)) {
        if (V.test(t))
          return (this.word = parseFloat(this.word)), void this.afterItem(t);
        throw new Error(
          "havn't handled \"" + t + '" in number yet, index ' + this.place,
        );
      }
      this.word += t;
    }),
    (i.prototype.quoted = function (t) {
      return '"' === t ? void (this.state = 5) : void (this.word += t);
    }),
    (i.prototype.keyword = function (t) {
      if (K.test(t)) this.word += t;
      else {
        if ("[" === t) {
          var s = [];
          return (
            s.push(this.word),
            this.level++,
            null === this.root ? (this.root = s) : this.currentObject.push(s),
            this.stack.push(this.currentObject),
            (this.currentObject = s),
            void (this.state = H)
          );
        }
        if (!V.test(t))
          throw new Error(
            "havn't handled \"" + t + '" in keyword yet, index ' + this.place,
          );
        this.afterItem(t);
      }
    }),
    (i.prototype.neutral = function (t) {
      if (J.test(t)) return (this.word = t), void (this.state = 2);
      if ('"' === t) return (this.word = ""), void (this.state = 4);
      if (Z.test(t)) return (this.word = t), void (this.state = 3);
      if (!V.test(t))
        throw new Error(
          "havn't handled \"" + t + '" in neutral yet, index ' + this.place,
        );
      this.afterItem(t);
    }),
    (i.prototype.output = function () {
      for (; this.place < this.text.length; ) this.readCharicter();
      if (-1 === this.state) return this.root;
      throw new Error(
        'unable to parse string "' + this.text + '". State is ' + this.state,
      );
    });
  var Y = 0.017453292519943295,
    $ = function (t) {
      var s = a(t),
        i = s.shift(),
        h = s.shift();
      s.unshift(["name", h]), s.unshift(["type", i]);
      var n = {};
      return e(s, n), r(n), n;
    };
  !(function (t) {
    t(
      "EPSG:4326",
      "+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees",
    ),
      t(
        "EPSG:4269",
        "+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees",
      ),
      t(
        "EPSG:3857",
        "+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs",
      ),
      (t.WGS84 = t["EPSG:4326"]),
      (t["EPSG:3785"] = t["EPSG:3857"]),
      (t.GOOGLE = t["EPSG:3857"]),
      (t["EPSG:900913"] = t["EPSG:3857"]),
      (t["EPSG:102113"] = t["EPSG:3857"]);
  })(o);
  var tt = [
      "PROJECTEDCRS",
      "PROJCRS",
      "GEOGCS",
      "GEOCCS",
      "PROJCS",
      "LOCAL_CS",
      "GEODCRS",
      "GEODETICCRS",
      "GEODETICDATUM",
      "ENGCRS",
      "ENGINEERINGCRS",
    ],
    st = function (t, s) {
      var i, a;
      if (((t = t || {}), !s)) return t;
      for (a in s) void 0 !== (i = s[a]) && (t[a] = i);
      return t;
    },
    it = function (t, s, i) {
      var a = t * s;
      return i / Math.sqrt(1 - a * a);
    },
    at = function (t) {
      return t < 0 ? -1 : 1;
    },
    ht = function (t) {
      return Math.abs(t) <= 3.14159265359 ? t : t - at(t) * B;
    },
    et = function (t, s, i) {
      var a = t * i,
        h = 0.5 * t;
      return (a = Math.pow((1 - a) / (1 + a), h)), Math.tan(0.5 * (O - s)) / a;
    },
    nt = function (t, s) {
      for (var i, a, h = 0.5 * t, e = O - 2 * Math.atan(s), n = 0; n <= 15; n++)
        if (
          ((i = t * Math.sin(e)),
          (e += a = O - 2 * Math.atan(s * Math.pow((1 - i) / (1 + i), h)) - e),
          Math.abs(a) <= 1e-10)
        )
          return e;
      return -9999;
    },
    rt = [
      {
        init: function () {
          var t = this.b / this.a;
          (this.es = 1 - t * t),
            "x0" in this || (this.x0 = 0),
            "y0" in this || (this.y0 = 0),
            (this.e = Math.sqrt(this.es)),
            this.lat_ts
              ? this.sphere
                ? (this.k0 = Math.cos(this.lat_ts))
                : (this.k0 = it(
                    this.e,
                    Math.sin(this.lat_ts),
                    Math.cos(this.lat_ts),
                  ))
              : this.k0 || (this.k ? (this.k0 = this.k) : (this.k0 = 1));
        },
        forward: function (t) {
          var s,
            i,
            a = t.x,
            h = t.y;
          if (h * T > 90 && h * T < -90 && a * T > 180 && a * T < -180)
            return null;
          if (Math.abs(Math.abs(h) - O) <= L) return null;
          if (this.sphere)
            (s = this.x0 + this.a * this.k0 * ht(a - this.long0)),
              (i =
                this.y0 + this.a * this.k0 * Math.log(Math.tan(D + 0.5 * h)));
          else {
            var e = Math.sin(h),
              n = et(this.e, h, e);
            (s = this.x0 + this.a * this.k0 * ht(a - this.long0)),
              (i = this.y0 - this.a * this.k0 * Math.log(n));
          }
          return (t.x = s), (t.y = i), t;
        },
        inverse: function (t) {
          var s,
            i,
            a = t.x - this.x0,
            h = t.y - this.y0;
          if (this.sphere)
            i = O - 2 * Math.atan(Math.exp(-h / (this.a * this.k0)));
          else {
            var e = Math.exp(-h / (this.a * this.k0));
            if (-9999 === (i = nt(this.e, e))) return null;
          }
          return (
            (s = ht(this.long0 + a / (this.a * this.k0))),
            (t.x = s),
            (t.y = i),
            t
          );
        },
        names: [
          "Mercator",
          "Popular Visualisation Pseudo Mercator",
          "Mercator_1SP",
          "Mercator_Auxiliary_Sphere",
          "merc",
        ],
      },
      {
        init: function () {},
        forward: M,
        inverse: M,
        names: ["longlat", "identity"],
      },
    ],
    ot = {},
    lt = [],
    Mt = {
      start: function () {
        rt.forEach(c);
      },
      add: c,
      get: function (t) {
        if (!t) return !1;
        var s = t.toLowerCase();
        return void 0 !== ot[s] && lt[ot[s]] ? lt[ot[s]] : void 0;
      },
    },
    ct = {
      MERIT: { a: 6378137, rf: 298.257, ellipseName: "MERIT 1983" },
      SGS85: {
        a: 6378136,
        rf: 298.257,
        ellipseName: "Soviet Geodetic System 85",
      },
      GRS80: {
        a: 6378137,
        rf: 298.257222101,
        ellipseName: "GRS 1980(IUGG, 1980)",
      },
      IAU76: { a: 6378140, rf: 298.257, ellipseName: "IAU 1976" },
      airy: { a: 6377563.396, b: 6356256.91, ellipseName: "Airy 1830" },
      APL4: { a: 6378137, rf: 298.25, ellipseName: "Appl. Physics. 1965" },
      NWL9D: {
        a: 6378145,
        rf: 298.25,
        ellipseName: "Naval Weapons Lab., 1965",
      },
      mod_airy: {
        a: 6377340.189,
        b: 6356034.446,
        ellipseName: "Modified Airy",
      },
      andrae: {
        a: 6377104.43,
        rf: 300,
        ellipseName: "Andrae 1876 (Den., Iclnd.)",
      },
      aust_SA: {
        a: 6378160,
        rf: 298.25,
        ellipseName: "Australian Natl & S. Amer. 1969",
      },
      GRS67: {
        a: 6378160,
        rf: 298.247167427,
        ellipseName: "GRS 67(IUGG 1967)",
      },
      bessel: { a: 6377397.155, rf: 299.1528128, ellipseName: "Bessel 1841" },
      bess_nam: {
        a: 6377483.865,
        rf: 299.1528128,
        ellipseName: "Bessel 1841 (Namibia)",
      },
      clrk66: { a: 6378206.4, b: 6356583.8, ellipseName: "Clarke 1866" },
      clrk80: { a: 6378249.145, rf: 293.4663, ellipseName: "Clarke 1880 mod." },
      clrk58: {
        a: 6378293.645208759,
        rf: 294.2606763692654,
        ellipseName: "Clarke 1858",
      },
      CPM: {
        a: 6375738.7,
        rf: 334.29,
        ellipseName: "Comm. des Poids et Mesures 1799",
      },
      delmbr: { a: 6376428, rf: 311.5, ellipseName: "Delambre 1810 (Belgium)" },
      engelis: { a: 6378136.05, rf: 298.2566, ellipseName: "Engelis 1985" },
      evrst30: { a: 6377276.345, rf: 300.8017, ellipseName: "Everest 1830" },
      evrst48: { a: 6377304.063, rf: 300.8017, ellipseName: "Everest 1948" },
      evrst56: { a: 6377301.243, rf: 300.8017, ellipseName: "Everest 1956" },
      evrst69: { a: 6377295.664, rf: 300.8017, ellipseName: "Everest 1969" },
      evrstSS: {
        a: 6377298.556,
        rf: 300.8017,
        ellipseName: "Everest (Sabah & Sarawak)",
      },
      fschr60: {
        a: 6378166,
        rf: 298.3,
        ellipseName: "Fischer (Mercury Datum) 1960",
      },
      fschr60m: { a: 6378155, rf: 298.3, ellipseName: "Fischer 1960" },
      fschr68: { a: 6378150, rf: 298.3, ellipseName: "Fischer 1968" },
      helmert: { a: 6378200, rf: 298.3, ellipseName: "Helmert 1906" },
      hough: { a: 6378270, rf: 297, ellipseName: "Hough" },
      intl: {
        a: 6378388,
        rf: 297,
        ellipseName: "International 1909 (Hayford)",
      },
      kaula: { a: 6378163, rf: 298.24, ellipseName: "Kaula 1961" },
      lerch: { a: 6378139, rf: 298.257, ellipseName: "Lerch 1979" },
      mprts: { a: 6397300, rf: 191, ellipseName: "Maupertius 1738" },
      new_intl: {
        a: 6378157.5,
        b: 6356772.2,
        ellipseName: "New International 1967",
      },
      plessis: {
        a: 6376523,
        rf: 6355863,
        ellipseName: "Plessis 1817 (France)",
      },
      krass: { a: 6378245, rf: 298.3, ellipseName: "Krassovsky, 1942" },
      SEasia: { a: 6378155, b: 6356773.3205, ellipseName: "Southeast Asia" },
      walbeck: { a: 6376896, b: 6355834.8467, ellipseName: "Walbeck" },
      WGS60: { a: 6378165, rf: 298.3, ellipseName: "WGS 60" },
      WGS66: { a: 6378145, rf: 298.25, ellipseName: "WGS 66" },
      WGS7: { a: 6378135, rf: 298.26, ellipseName: "WGS 72" },
    },
    ut = (ct.WGS84 = { a: 6378137, rf: 298.257223563, ellipseName: "WGS 84" });
  ct.sphere = {
    a: 6370997,
    b: 6370997,
    ellipseName: "Normal Sphere (r=6370997)",
  };
  var ft = {
    wgs84: { towgs84: "0,0,0", ellipse: "WGS84", datumName: "WGS84" },
    ch1903: {
      towgs84: "674.374,15.056,405.346",
      ellipse: "bessel",
      datumName: "swiss",
    },
    ggrs87: {
      towgs84: "-199.87,74.79,246.62",
      ellipse: "GRS80",
      datumName: "Greek_Geodetic_Reference_System_1987",
    },
    nad83: {
      towgs84: "0,0,0",
      ellipse: "GRS80",
      datumName: "North_American_Datum_1983",
    },
    nad27: {
      nadgrids: "@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",
      ellipse: "clrk66",
      datumName: "North_American_Datum_1927",
    },
    potsdam: {
      towgs84: "606.0,23.0,413.0",
      ellipse: "bessel",
      datumName: "Potsdam Rauenberg 1950 DHDN",
    },
    carthage: {
      towgs84: "-263.0,6.0,431.0",
      ellipse: "clark80",
      datumName: "Carthage 1934 Tunisia",
    },
    hermannskogel: {
      towgs84: "653.0,-212.0,449.0",
      ellipse: "bessel",
      datumName: "Hermannskogel",
    },
    ire65: {
      towgs84: "482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",
      ellipse: "mod_airy",
      datumName: "Ireland 1965",
    },
    rassadiran: {
      towgs84: "-133.63,-157.5,-158.62",
      ellipse: "intl",
      datumName: "Rassadiran",
    },
    nzgd49: {
      towgs84: "59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",
      ellipse: "intl",
      datumName: "New Zealand Geodetic Datum 1949",
    },
    osgb36: {
      towgs84: "446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",
      ellipse: "airy",
      datumName: "Airy 1830",
    },
    s_jtsk: {
      towgs84: "589,76,480",
      ellipse: "bessel",
      datumName: "S-JTSK (Ferro)",
    },
    beduaram: {
      towgs84: "-106,-87,188",
      ellipse: "clrk80",
      datumName: "Beduaram",
    },
    gunung_segara: {
      towgs84: "-403,684,41",
      ellipse: "bessel",
      datumName: "Gunung Segara Jakarta",
    },
    rnb72: {
      towgs84: "106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",
      ellipse: "intl",
      datumName: "Reseau National Belge 1972",
    },
  };
  (u.projections = Mt), u.projections.start();
  var pt = function (t, s, i) {
      return (function (t, s) {
        return (
          t.datum_type === s.datum_type &&
          !(t.a !== s.a || Math.abs(t.es - s.es) > 5e-11) &&
          (t.datum_type === k
            ? t.datum_params[0] === s.datum_params[0] &&
              t.datum_params[1] === s.datum_params[1] &&
              t.datum_params[2] === s.datum_params[2]
            : t.datum_type !== E ||
              (t.datum_params[0] === s.datum_params[0] &&
                t.datum_params[1] === s.datum_params[1] &&
                t.datum_params[2] === s.datum_params[2] &&
                t.datum_params[3] === s.datum_params[3] &&
                t.datum_params[4] === s.datum_params[4] &&
                t.datum_params[5] === s.datum_params[5] &&
                t.datum_params[6] === s.datum_params[6]))
        );
      })(t, s) ||
        t.datum_type === I ||
        s.datum_type === I
        ? i
        : t.es !== s.es || t.a !== s.a || f(t.datum_type) || f(s.datum_type)
          ? ((i = (function (t, s, i) {
              var a,
                h,
                e,
                n,
                r = t.x,
                o = t.y,
                l = t.z ? t.z : 0;
              if (o < -O && o > -1.001 * O) o = -O;
              else if (o > O && o < 1.001 * O) o = O;
              else if (o < -O || o > O) return null;
              return (
                r > Math.PI && (r -= 2 * Math.PI),
                (h = Math.sin(o)),
                (n = Math.cos(o)),
                (e = h * h),
                {
                  x: ((a = i / Math.sqrt(1 - s * e)) + l) * n * Math.cos(r),
                  y: (a + l) * n * Math.sin(r),
                  z: (a * (1 - s) + l) * h,
                }
              );
            })(i, t.es, t.a)),
            f(t.datum_type) &&
              (i = (function (t, s, i) {
                if (s === k)
                  return { x: t.x + i[0], y: t.y + i[1], z: t.z + i[2] };
                if (s === E) {
                  var a = i[0],
                    h = i[1],
                    e = i[2],
                    n = i[3],
                    r = i[4],
                    o = i[5],
                    l = i[6];
                  return {
                    x: l * (t.x - o * t.y + r * t.z) + a,
                    y: l * (o * t.x + t.y - n * t.z) + h,
                    z: l * (-r * t.x + n * t.y + t.z) + e,
                  };
                }
              })(i, t.datum_type, t.datum_params)),
            f(s.datum_type) &&
              (i = (function (t, s, i) {
                if (s === k)
                  return { x: t.x - i[0], y: t.y - i[1], z: t.z - i[2] };
                if (s === E) {
                  var a = i[0],
                    h = i[1],
                    e = i[2],
                    n = i[3],
                    r = i[4],
                    o = i[5],
                    l = i[6],
                    M = (t.x - a) / l,
                    c = (t.y - h) / l,
                    u = (t.z - e) / l;
                  return {
                    x: M + o * c - r * u,
                    y: -o * M + c + n * u,
                    z: r * M - n * c + u,
                  };
                }
              })(i, s.datum_type, s.datum_params)),
            (function (t, s, i, a) {
              var h,
                e,
                n,
                r,
                o,
                l,
                M,
                c,
                u,
                f,
                p,
                m,
                d,
                y,
                _,
                x = 1e-12,
                g = t.x,
                b = t.y,
                v = t.z ? t.z : 0;
              if (
                ((h = Math.sqrt(g * g + b * b)),
                (e = Math.sqrt(g * g + b * b + v * v)),
                h / i < x)
              ) {
                if (((y = 0), e / i < x))
                  return O, (_ = -a), { x: t.x, y: t.y, z: t.z };
              } else y = Math.atan2(b, g);
              (n = v / e),
                (c =
                  (r = h / e) *
                  (1 - s) *
                  (o = 1 / Math.sqrt(1 - s * (2 - s) * r * r))),
                (u = n * o),
                (d = 0);
              do {
                d++,
                  (l =
                    (s * (M = i / Math.sqrt(1 - s * u * u))) /
                    (M + (_ = h * c + v * u - M * (1 - s * u * u)))),
                  (m =
                    (p = n * (o = 1 / Math.sqrt(1 - l * (2 - l) * r * r))) * c -
                    (f = r * (1 - l) * o) * u),
                  (c = f),
                  (u = p);
              } while (m * m > 1e-24 && d < 30);
              return { x: y, y: Math.atan(p / Math.abs(f)), z: _ };
            })(i, s.es, s.a, s.b))
          : i;
    },
    mt = function (t, s, i) {
      var a,
        h,
        e,
        n = i.x,
        r = i.y,
        o = i.z || 0,
        l = {};
      for (e = 0; e < 3; e++)
        if (!s || 2 !== e || void 0 !== i.z)
          switch (
            (0 === e
              ? ((a = n), (h = "x"))
              : 1 === e
                ? ((a = r), (h = "y"))
                : ((a = o), (h = "z")),
            t.axis[e])
          ) {
            case "e":
              l[h] = a;
              break;
            case "w":
              l[h] = -a;
              break;
            case "n":
              l[h] = a;
              break;
            case "s":
              l[h] = -a;
              break;
            case "u":
              void 0 !== i[h] && (l.z = a);
              break;
            case "d":
              void 0 !== i[h] && (l.z = -a);
              break;
            default:
              return null;
          }
      return l;
    },
    dt = function (t) {
      var s = { x: t[0], y: t[1] };
      return t.length > 2 && (s.z = t[2]), t.length > 3 && (s.m = t[3]), s;
    },
    yt = u("WGS84"),
    _t = 6,
    xt = "AJSAJS",
    gt = "AFAFAF",
    bt = 65,
    vt = 73,
    wt = 79,
    Ct = 86,
    Pt = 90,
    Nt = {
      forward: _,
      inverse: function (t) {
        var s = v(P(t.toUpperCase()));
        return s.lat && s.lon
          ? [s.lon, s.lat, s.lon, s.lat]
          : [s.left, s.bottom, s.right, s.top];
      },
      toPoint: x,
    };
  (S.fromMGRS = function (t) {
    return new S(x(t));
  }),
    (S.prototype.toMGRS = function (t) {
      return _([this.x, this.y], t);
    });
  var St,
    kt = 0.01953125,
    Et = 0.01068115234375,
    qt = function (t) {
      var s = [];
      (s[0] = 1 - t * (0.25 + t * (0.046875 + t * (kt + t * Et)))),
        (s[1] = t * (0.75 - t * (0.046875 + t * (kt + t * Et))));
      var i = t * t;
      return (
        (s[2] =
          i *
          (0.46875 - t * (0.013020833333333334 + 0.007120768229166667 * t))),
        (i *= t),
        (s[3] = i * (0.3645833333333333 - 0.005696614583333333 * t)),
        (s[4] = i * t * 0.3076171875),
        s
      );
    },
    It = function (t, s, i, a) {
      return (
        (i *= s),
        (s *= s),
        a[0] * t - i * (a[1] + s * (a[2] + s * (a[3] + s * a[4])))
      );
    },
    At = function (t, s, i) {
      for (var a = 1 / (1 - s), h = t, e = 20; e; --e) {
        var n = Math.sin(h),
          r = 1 - s * n * n;
        if (
          ((h -= r = (It(h, n, Math.cos(h), i) - t) * (r * Math.sqrt(r)) * a),
          Math.abs(r) < L)
        )
          return h;
      }
      return h;
    },
    Ot = {
      init: function () {
        (this.x0 = void 0 !== this.x0 ? this.x0 : 0),
          (this.y0 = void 0 !== this.y0 ? this.y0 : 0),
          (this.long0 = void 0 !== this.long0 ? this.long0 : 0),
          (this.lat0 = void 0 !== this.lat0 ? this.lat0 : 0),
          this.es &&
            ((this.en = qt(this.es)),
            (this.ml0 = It(
              this.lat0,
              Math.sin(this.lat0),
              Math.cos(this.lat0),
              this.en,
            )));
      },
      forward: function (t) {
        var s,
          i,
          a,
          h = t.x,
          e = t.y,
          n = ht(h - this.long0),
          r = Math.sin(e),
          o = Math.cos(e);
        if (this.es) {
          var l = o * n,
            M = Math.pow(l, 2),
            c = this.ep2 * Math.pow(o, 2),
            u = Math.pow(c, 2),
            f = Math.abs(o) > L ? Math.tan(e) : 0,
            p = Math.pow(f, 2),
            m = Math.pow(p, 2);
          (s = 1 - this.es * Math.pow(r, 2)), (l /= Math.sqrt(s));
          var d = It(e, r, o, this.en);
          (i =
            this.a *
              (this.k0 *
                l *
                (1 +
                  (M / 6) *
                    (1 -
                      p +
                      c +
                      (M / 20) *
                        (5 -
                          18 * p +
                          m +
                          14 * c -
                          58 * p * c +
                          (M / 42) * (61 + 179 * m - m * p - 479 * p))))) +
            this.x0),
            (a =
              this.a *
                (this.k0 *
                  (d -
                    this.ml0 +
                    ((r * n * l) / 2) *
                      (1 +
                        (M / 12) *
                          (5 -
                            p +
                            9 * c +
                            4 * u +
                            (M / 30) *
                              (61 +
                                m -
                                58 * p +
                                270 * c -
                                330 * p * c +
                                (M / 56) *
                                  (1385 + 543 * m - m * p - 3111 * p)))))) +
              this.y0);
        } else {
          var y = o * Math.sin(n);
          if (Math.abs(Math.abs(y) - 1) < L) return 93;
          if (
            ((i =
              0.5 * this.a * this.k0 * Math.log((1 + y) / (1 - y)) + this.x0),
            (a = (o * Math.cos(n)) / Math.sqrt(1 - Math.pow(y, 2))),
            (y = Math.abs(a)) >= 1)
          ) {
            if (y - 1 > L) return 93;
            a = 0;
          } else a = Math.acos(a);
          e < 0 && (a = -a), (a = this.a * this.k0 * (a - this.lat0) + this.y0);
        }
        return (t.x = i), (t.y = a), t;
      },
      inverse: function (t) {
        var s,
          i,
          a,
          h,
          e = (t.x - this.x0) * (1 / this.a),
          n = (t.y - this.y0) * (1 / this.a);
        if (this.es)
          if (
            ((s = this.ml0 + n / this.k0),
            (i = At(s, this.es, this.en)),
            Math.abs(i) < O)
          ) {
            var r = Math.sin(i),
              o = Math.cos(i),
              l = Math.abs(o) > L ? Math.tan(i) : 0,
              M = this.ep2 * Math.pow(o, 2),
              c = Math.pow(M, 2),
              u = Math.pow(l, 2),
              f = Math.pow(u, 2);
            s = 1 - this.es * Math.pow(r, 2);
            var p = (e * Math.sqrt(s)) / this.k0,
              m = Math.pow(p, 2);
            (a =
              i -
              (((s *= l) * m) / (1 - this.es)) *
                0.5 *
                (1 -
                  (m / 12) *
                    (5 +
                      3 * u -
                      9 * M * u +
                      M -
                      4 * c -
                      (m / 30) *
                        (61 +
                          90 * u -
                          252 * M * u +
                          45 * f +
                          46 * M -
                          (m / 56) *
                            (1385 + 3633 * u + 4095 * f + 1574 * f * u))))),
              (h = ht(
                this.long0 +
                  (p *
                    (1 -
                      (m / 6) *
                        (1 +
                          2 * u +
                          M -
                          (m / 20) *
                            (5 +
                              28 * u +
                              24 * f +
                              8 * M * u +
                              6 * M -
                              (m / 42) *
                                (61 + 662 * u + 1320 * f + 720 * f * u))))) /
                    o,
              ));
          } else (a = O * at(n)), (h = 0);
        else {
          var d = Math.exp(e / this.k0),
            y = 0.5 * (d - 1 / d),
            _ = this.lat0 + n / this.k0,
            x = Math.cos(_);
          (s = Math.sqrt((1 - Math.pow(x, 2)) / (1 + Math.pow(y, 2)))),
            (a = Math.asin(s)),
            n < 0 && (a = -a),
            (h = 0 === y && 0 === x ? 0 : ht(Math.atan2(y, x) + this.long0));
        }
        return (t.x = h), (t.y = a), t;
      },
      names: ["Transverse_Mercator", "Transverse Mercator", "tmerc"],
    },
    Gt = function (t) {
      var s = Math.exp(t);
      return (s - 1 / s) / 2;
    },
    jt = function (t, s) {
      (t = Math.abs(t)), (s = Math.abs(s));
      var i = Math.max(t, s),
        a = Math.min(t, s) / (i || 1);
      return i * Math.sqrt(1 + Math.pow(a, 2));
    },
    Rt = function (t) {
      var s = Math.abs(t);
      return (
        (s = (function (t) {
          var s = 1 + t,
            i = s - 1;
          return 0 === i ? t : (t * Math.log(s)) / i;
        })(s * (1 + s / (jt(1, s) + 1)))),
        t < 0 ? -s : s
      );
    },
    Lt = function (t, s) {
      for (
        var i, a = 2 * Math.cos(2 * s), h = t.length - 1, e = t[h], n = 0;
        --h >= 0;

      )
        (i = a * e - n + t[h]), (n = e), (e = i);
      return s + i * Math.sin(2 * s);
    },
    zt = function (t, s) {
      for (
        var i, a = 2 * Math.cos(s), h = t.length - 1, e = t[h], n = 0;
        --h >= 0;

      )
        (i = a * e - n + t[h]), (n = e), (e = i);
      return Math.sin(s) * i;
    },
    Tt = function (t, s, i) {
      for (
        var a,
          h,
          e = Math.sin(s),
          n = Math.cos(s),
          r = Gt(i),
          o = (function (t) {
            var s = Math.exp(t);
            return (s + 1 / s) / 2;
          })(i),
          l = 2 * n * o,
          M = -2 * e * r,
          c = t.length - 1,
          u = t[c],
          f = 0,
          p = 0,
          m = 0;
        --c >= 0;

      )
        (a = p),
          (h = f),
          (u = l * (p = u) - a - M * (f = m) + t[c]),
          (m = M * p - h + l * f);
      return [(l = e * o) * u - (M = n * r) * m, l * m + M * u];
    },
    Dt = {
      init: function () {
        if (void 0 === this.es || this.es <= 0)
          throw new Error("incorrect elliptical usage");
        (this.x0 = void 0 !== this.x0 ? this.x0 : 0),
          (this.y0 = void 0 !== this.y0 ? this.y0 : 0),
          (this.long0 = void 0 !== this.long0 ? this.long0 : 0),
          (this.lat0 = void 0 !== this.lat0 ? this.lat0 : 0),
          (this.cgb = []),
          (this.cbg = []),
          (this.utg = []),
          (this.gtu = []);
        var t = this.es / (1 + Math.sqrt(1 - this.es)),
          s = t / (2 - t),
          i = s;
        (this.cgb[0] =
          s *
          (2 +
            s *
              (-2 / 3 +
                s * (s * (116 / 45 + s * (26 / 45 + s * (-2854 / 675))) - 2)))),
          (this.cbg[0] =
            s *
            (s *
              (2 / 3 +
                s *
                  (4 / 3 +
                    s * (-82 / 45 + s * (32 / 45 + s * (4642 / 4725))))) -
              2)),
          (i *= s),
          (this.cgb[1] =
            i *
            (7 / 3 +
              s *
                (s * (-227 / 45 + s * (2704 / 315 + s * (2323 / 945))) - 1.6))),
          (this.cbg[1] =
            i *
            (5 / 3 +
              s *
                (-16 / 15 +
                  s * (-13 / 9 + s * (904 / 315 + s * (-1522 / 945)))))),
          (i *= s),
          (this.cgb[2] =
            i *
            (56 / 15 +
              s * (-136 / 35 + s * (-1262 / 105 + s * (73814 / 2835))))),
          (this.cbg[2] =
            i * (-26 / 15 + s * (34 / 21 + s * (1.6 + s * (-12686 / 2835))))),
          (i *= s),
          (this.cgb[3] =
            i * (4279 / 630 + s * (-332 / 35 + s * (-399572 / 14175)))),
          (this.cbg[3] = i * (1237 / 630 + s * (s * (-24832 / 14175) - 2.4))),
          (i *= s),
          (this.cgb[4] = i * (4174 / 315 + s * (-144838 / 6237))),
          (this.cbg[4] = i * (-734 / 315 + s * (109598 / 31185))),
          (i *= s),
          (this.cgb[5] = i * (601676 / 22275)),
          (this.cbg[5] = i * (444337 / 155925)),
          (i = Math.pow(s, 2)),
          (this.Qn =
            (this.k0 / (1 + s)) * (1 + i * (0.25 + i * (1 / 64 + i / 256)))),
          (this.utg[0] =
            s *
            (s *
              (2 / 3 +
                s *
                  (-37 / 96 +
                    s * (1 / 360 + s * (81 / 512 + s * (-96199 / 604800))))) -
              0.5)),
          (this.gtu[0] =
            s *
            (0.5 +
              s *
                (-2 / 3 +
                  s *
                    (5 / 16 +
                      s *
                        (41 / 180 + s * (-127 / 288 + s * (7891 / 37800))))))),
          (this.utg[1] =
            i *
            (-1 / 48 +
              s *
                (-1 / 15 +
                  s *
                    (437 / 1440 + s * (-46 / 105 + s * (1118711 / 3870720)))))),
          (this.gtu[1] =
            i *
            (13 / 48 +
              s *
                (s * (557 / 1440 + s * (281 / 630 + s * (-1983433 / 1935360))) -
                  0.6))),
          (i *= s),
          (this.utg[2] =
            i *
            (-17 / 480 +
              s * (37 / 840 + s * (209 / 4480 + s * (-5569 / 90720))))),
          (this.gtu[2] =
            i *
            (61 / 240 +
              s * (-103 / 140 + s * (15061 / 26880 + s * (167603 / 181440))))),
          (i *= s),
          (this.utg[3] =
            i * (-4397 / 161280 + s * (11 / 504 + s * (830251 / 7257600)))),
          (this.gtu[3] =
            i * (49561 / 161280 + s * (-179 / 168 + s * (6601661 / 7257600)))),
          (i *= s),
          (this.utg[4] = i * (-4583 / 161280 + s * (108847 / 3991680))),
          (this.gtu[4] = i * (34729 / 80640 + s * (-3418889 / 1995840))),
          (i *= s),
          (this.utg[5] = -0.03233083094085698 * i),
          (this.gtu[5] = 0.6650675310896665 * i);
        var a = Lt(this.cbg, this.lat0);
        this.Zb = -this.Qn * (a + zt(this.gtu, 2 * a));
      },
      forward: function (t) {
        var s = ht(t.x - this.long0),
          i = t.y;
        i = Lt(this.cbg, i);
        var a = Math.sin(i),
          h = Math.cos(i),
          e = Math.sin(s),
          n = Math.cos(s);
        (i = Math.atan2(a, n * h)),
          (s = Math.atan2(e * h, jt(a, h * n))),
          (s = Rt(Math.tan(s)));
        var r,
          o,
          l = Tt(this.gtu, 2 * i, 2 * s);
        return (
          (i += l[0]),
          (s += l[1]),
          Math.abs(s) <= 2.623395162778
            ? ((r = this.a * (this.Qn * s) + this.x0),
              (o = this.a * (this.Qn * i + this.Zb) + this.y0))
            : ((r = 1 / 0), (o = 1 / 0)),
          (t.x = r),
          (t.y = o),
          t
        );
      },
      inverse: function (t) {
        var s,
          i,
          a = (t.x - this.x0) * (1 / this.a),
          h = (t.y - this.y0) * (1 / this.a);
        if (
          ((h = (h - this.Zb) / this.Qn),
          (a /= this.Qn),
          Math.abs(a) <= 2.623395162778)
        ) {
          var e = Tt(this.utg, 2 * h, 2 * a);
          (h += e[0]), (a += e[1]), (a = Math.atan(Gt(a)));
          var n = Math.sin(h),
            r = Math.cos(h),
            o = Math.sin(a),
            l = Math.cos(a);
          (h = Math.atan2(n * l, jt(o, l * r))),
            (a = Math.atan2(o, l * r)),
            (s = ht(a + this.long0)),
            (i = Lt(this.cgb, h));
        } else (s = 1 / 0), (i = 1 / 0);
        return (t.x = s), (t.y = i), t;
      },
      names: [
        "Extended_Transverse_Mercator",
        "Extended Transverse Mercator",
        "etmerc",
      ],
    },
    Bt = function (t, s) {
      if (void 0 === t) {
        if ((t = Math.floor((30 * (ht(s) + Math.PI)) / Math.PI) + 1) < 0)
          return 0;
        if (t > 60) return 60;
      }
      return t;
    },
    Ut = {
      init: function () {
        var t = Bt(this.zone, this.long0);
        if (void 0 === t) throw new Error("unknown utm zone");
        (this.lat0 = 0),
          (this.long0 = (6 * Math.abs(t) - 183) * z),
          (this.x0 = 5e5),
          (this.y0 = this.utmSouth ? 1e7 : 0),
          (this.k0 = 0.9996),
          Dt.init.apply(this),
          (this.forward = Dt.forward),
          (this.inverse = Dt.inverse);
      },
      names: ["Universal Transverse Mercator System", "utm"],
      dependsOn: "etmerc",
    },
    Ft = function (t, s) {
      return Math.pow((1 - t) / (1 + t), s);
    },
    Qt = 20,
    Wt = {
      init: function () {
        var t = Math.sin(this.lat0),
          s = Math.cos(this.lat0);
        (s *= s),
          (this.rc = Math.sqrt(1 - this.es) / (1 - this.es * t * t)),
          (this.C = Math.sqrt(1 + (this.es * s * s) / (1 - this.es))),
          (this.phic0 = Math.asin(t / this.C)),
          (this.ratexp = 0.5 * this.C * this.e),
          (this.K =
            Math.tan(0.5 * this.phic0 + D) /
            (Math.pow(Math.tan(0.5 * this.lat0 + D), this.C) *
              Ft(this.e * t, this.ratexp)));
      },
      forward: function (t) {
        var s = t.x,
          i = t.y;
        return (
          (t.y =
            2 *
              Math.atan(
                this.K *
                  Math.pow(Math.tan(0.5 * i + D), this.C) *
                  Ft(this.e * Math.sin(i), this.ratexp),
              ) -
            O),
          (t.x = this.C * s),
          t
        );
      },
      inverse: function (t) {
        for (
          var s = t.x / this.C,
            i = t.y,
            a = Math.pow(Math.tan(0.5 * i + D) / this.K, 1 / this.C),
            h = Qt;
          h > 0 &&
          ((i =
            2 * Math.atan(a * Ft(this.e * Math.sin(t.y), -0.5 * this.e)) - O),
          !(Math.abs(i - t.y) < 1e-14));
          --h
        )
          t.y = i;
        return h ? ((t.x = s), (t.y = i), t) : null;
      },
      names: ["gauss"],
    },
    Ht = {
      init: function () {
        Wt.init.apply(this),
          this.rc &&
            ((this.sinc0 = Math.sin(this.phic0)),
            (this.cosc0 = Math.cos(this.phic0)),
            (this.R2 = 2 * this.rc),
            this.title || (this.title = "Oblique Stereographic Alternative"));
      },
      forward: function (t) {
        var s, i, a, h;
        return (
          (t.x = ht(t.x - this.long0)),
          Wt.forward.apply(this, [t]),
          (s = Math.sin(t.y)),
          (i = Math.cos(t.y)),
          (a = Math.cos(t.x)),
          (h = (this.k0 * this.R2) / (1 + this.sinc0 * s + this.cosc0 * i * a)),
          (t.x = h * i * Math.sin(t.x)),
          (t.y = h * (this.cosc0 * s - this.sinc0 * i * a)),
          (t.x = this.a * t.x + this.x0),
          (t.y = this.a * t.y + this.y0),
          t
        );
      },
      inverse: function (t) {
        var s, i, a, h, e;
        if (
          ((t.x = (t.x - this.x0) / this.a),
          (t.y = (t.y - this.y0) / this.a),
          (t.x /= this.k0),
          (t.y /= this.k0),
          (e = Math.sqrt(t.x * t.x + t.y * t.y)))
        ) {
          var n = 2 * Math.atan2(e, this.R2);
          (s = Math.sin(n)),
            (i = Math.cos(n)),
            (h = Math.asin(i * this.sinc0 + (t.y * s * this.cosc0) / e)),
            (a = Math.atan2(
              t.x * s,
              e * this.cosc0 * i - t.y * this.sinc0 * s,
            ));
        } else (h = this.phic0), (a = 0);
        return (
          (t.x = a),
          (t.y = h),
          Wt.inverse.apply(this, [t]),
          (t.x = ht(t.x + this.long0)),
          t
        );
      },
      names: [
        "Stereographic_North_Pole",
        "Oblique_Stereographic",
        "Polar_Stereographic",
        "sterea",
        "Oblique Stereographic Alternative",
      ],
    },
    Xt = {
      init: function () {
        (this.coslat0 = Math.cos(this.lat0)),
          (this.sinlat0 = Math.sin(this.lat0)),
          this.sphere
            ? 1 === this.k0 &&
              !isNaN(this.lat_ts) &&
              Math.abs(this.coslat0) <= L &&
              (this.k0 = 0.5 * (1 + at(this.lat0) * Math.sin(this.lat_ts)))
            : (Math.abs(this.coslat0) <= L &&
                (this.lat0 > 0 ? (this.con = 1) : (this.con = -1)),
              (this.cons = Math.sqrt(
                Math.pow(1 + this.e, 1 + this.e) *
                  Math.pow(1 - this.e, 1 - this.e),
              )),
              1 === this.k0 &&
                !isNaN(this.lat_ts) &&
                Math.abs(this.coslat0) <= L &&
                (this.k0 =
                  (0.5 *
                    this.cons *
                    it(this.e, Math.sin(this.lat_ts), Math.cos(this.lat_ts))) /
                  et(
                    this.e,
                    this.con * this.lat_ts,
                    this.con * Math.sin(this.lat_ts),
                  )),
              (this.ms1 = it(this.e, this.sinlat0, this.coslat0)),
              (this.X0 =
                2 * Math.atan(this.ssfn_(this.lat0, this.sinlat0, this.e)) - O),
              (this.cosX0 = Math.cos(this.X0)),
              (this.sinX0 = Math.sin(this.X0)));
      },
      forward: function (t) {
        var s,
          i,
          a,
          h,
          e,
          n,
          r = t.x,
          o = t.y,
          l = Math.sin(o),
          M = Math.cos(o),
          c = ht(r - this.long0);
        return Math.abs(Math.abs(r - this.long0) - Math.PI) <= L &&
          Math.abs(o + this.lat0) <= L
          ? ((t.x = NaN), (t.y = NaN), t)
          : this.sphere
            ? ((s =
                (2 * this.k0) /
                (1 + this.sinlat0 * l + this.coslat0 * M * Math.cos(c))),
              (t.x = this.a * s * M * Math.sin(c) + this.x0),
              (t.y =
                this.a *
                  s *
                  (this.coslat0 * l - this.sinlat0 * M * Math.cos(c)) +
                this.y0),
              t)
            : ((i = 2 * Math.atan(this.ssfn_(o, l, this.e)) - O),
              (h = Math.cos(i)),
              (a = Math.sin(i)),
              Math.abs(this.coslat0) <= L
                ? ((e = et(this.e, o * this.con, this.con * l)),
                  (n = (2 * this.a * this.k0 * e) / this.cons),
                  (t.x = this.x0 + n * Math.sin(r - this.long0)),
                  (t.y = this.y0 - this.con * n * Math.cos(r - this.long0)),
                  t)
                : (Math.abs(this.sinlat0) < L
                    ? ((s = (2 * this.a * this.k0) / (1 + h * Math.cos(c))),
                      (t.y = s * a))
                    : ((s =
                        (2 * this.a * this.k0 * this.ms1) /
                        (this.cosX0 *
                          (1 + this.sinX0 * a + this.cosX0 * h * Math.cos(c)))),
                      (t.y =
                        s * (this.cosX0 * a - this.sinX0 * h * Math.cos(c)) +
                        this.y0)),
                  (t.x = s * h * Math.sin(c) + this.x0),
                  t));
      },
      inverse: function (t) {
        (t.x -= this.x0), (t.y -= this.y0);
        var s,
          i,
          a,
          h,
          e,
          n = Math.sqrt(t.x * t.x + t.y * t.y);
        if (this.sphere) {
          var r = 2 * Math.atan(n / (0.5 * this.a * this.k0));
          return (
            (s = this.long0),
            (i = this.lat0),
            n <= L
              ? ((t.x = s), (t.y = i), t)
              : ((i = Math.asin(
                  Math.cos(r) * this.sinlat0 +
                    (t.y * Math.sin(r) * this.coslat0) / n,
                )),
                (s = ht(
                  Math.abs(this.coslat0) < L
                    ? this.lat0 > 0
                      ? this.long0 + Math.atan2(t.x, -1 * t.y)
                      : this.long0 + Math.atan2(t.x, t.y)
                    : this.long0 +
                        Math.atan2(
                          t.x * Math.sin(r),
                          n * this.coslat0 * Math.cos(r) -
                            t.y * this.sinlat0 * Math.sin(r),
                        ),
                )),
                (t.x = s),
                (t.y = i),
                t)
          );
        }
        if (Math.abs(this.coslat0) <= L) {
          if (n <= L)
            return (i = this.lat0), (s = this.long0), (t.x = s), (t.y = i), t;
          (t.x *= this.con),
            (t.y *= this.con),
            (a = (n * this.cons) / (2 * this.a * this.k0)),
            (i = this.con * nt(this.e, a)),
            (s =
              this.con * ht(this.con * this.long0 + Math.atan2(t.x, -1 * t.y)));
        } else
          (h =
            2 *
            Math.atan((n * this.cosX0) / (2 * this.a * this.k0 * this.ms1))),
            (s = this.long0),
            n <= L
              ? (e = this.X0)
              : ((e = Math.asin(
                  Math.cos(h) * this.sinX0 +
                    (t.y * Math.sin(h) * this.cosX0) / n,
                )),
                (s = ht(
                  this.long0 +
                    Math.atan2(
                      t.x * Math.sin(h),
                      n * this.cosX0 * Math.cos(h) -
                        t.y * this.sinX0 * Math.sin(h),
                    ),
                ))),
            (i = -1 * nt(this.e, Math.tan(0.5 * (O + e))));
        return (t.x = s), (t.y = i), t;
      },
      names: [
        "stere",
        "Stereographic_South_Pole",
        "Polar Stereographic (variant B)",
      ],
      ssfn_: function (t, s, i) {
        return (
          (s *= i),
          Math.tan(0.5 * (O + t)) * Math.pow((1 - s) / (1 + s), 0.5 * i)
        );
      },
    },
    Jt = {
      init: function () {
        var t = this.lat0;
        this.lambda0 = this.long0;
        var s = Math.sin(t),
          i = this.a,
          a = 1 / this.rf,
          h = 2 * a - Math.pow(a, 2),
          e = (this.e = Math.sqrt(h));
        (this.R = (this.k0 * i * Math.sqrt(1 - h)) / (1 - h * Math.pow(s, 2))),
          (this.alpha = Math.sqrt(
            1 + (h / (1 - h)) * Math.pow(Math.cos(t), 4),
          )),
          (this.b0 = Math.asin(s / this.alpha));
        var n = Math.log(Math.tan(Math.PI / 4 + this.b0 / 2)),
          r = Math.log(Math.tan(Math.PI / 4 + t / 2)),
          o = Math.log((1 + e * s) / (1 - e * s));
        this.K = n - this.alpha * r + ((this.alpha * e) / 2) * o;
      },
      forward: function (t) {
        var s = Math.log(Math.tan(Math.PI / 4 - t.y / 2)),
          i =
            (this.e / 2) *
            Math.log(
              (1 + this.e * Math.sin(t.y)) / (1 - this.e * Math.sin(t.y)),
            ),
          a = -this.alpha * (s + i) + this.K,
          h = 2 * (Math.atan(Math.exp(a)) - Math.PI / 4),
          e = this.alpha * (t.x - this.lambda0),
          n = Math.atan(
            Math.sin(e) /
              (Math.sin(this.b0) * Math.tan(h) +
                Math.cos(this.b0) * Math.cos(e)),
          ),
          r = Math.asin(
            Math.cos(this.b0) * Math.sin(h) -
              Math.sin(this.b0) * Math.cos(h) * Math.cos(e),
          );
        return (
          (t.y =
            (this.R / 2) * Math.log((1 + Math.sin(r)) / (1 - Math.sin(r))) +
            this.y0),
          (t.x = this.R * n + this.x0),
          t
        );
      },
      inverse: function (t) {
        for (
          var s = t.x - this.x0,
            i = t.y - this.y0,
            a = s / this.R,
            h = 2 * (Math.atan(Math.exp(i / this.R)) - Math.PI / 4),
            e = Math.asin(
              Math.cos(this.b0) * Math.sin(h) +
                Math.sin(this.b0) * Math.cos(h) * Math.cos(a),
            ),
            n = Math.atan(
              Math.sin(a) /
                (Math.cos(this.b0) * Math.cos(a) -
                  Math.sin(this.b0) * Math.tan(h)),
            ),
            r = this.lambda0 + n / this.alpha,
            o = 0,
            l = e,
            M = -1e3,
            c = 0;
          Math.abs(l - M) > 1e-7;

        ) {
          if (++c > 20) return;
          (o =
            (1 / this.alpha) *
              (Math.log(Math.tan(Math.PI / 4 + e / 2)) - this.K) +
            this.e *
              Math.log(
                Math.tan(Math.PI / 4 + Math.asin(this.e * Math.sin(l)) / 2),
              )),
            (M = l),
            (l = 2 * Math.atan(Math.exp(o)) - Math.PI / 2);
        }
        return (t.x = r), (t.y = l), t;
      },
      names: ["somerc"],
    },
    Kt = {
      init: function () {
        (this.no_off = this.no_off || !1),
          (this.no_rot = this.no_rot || !1),
          isNaN(this.k0) && (this.k0 = 1);
        var t = Math.sin(this.lat0),
          s = Math.cos(this.lat0),
          i = this.e * t;
        (this.bl = Math.sqrt(1 + (this.es / (1 - this.es)) * Math.pow(s, 4))),
          (this.al =
            (this.a * this.bl * this.k0 * Math.sqrt(1 - this.es)) /
            (1 - i * i));
        var a,
          h,
          e = et(this.e, this.lat0, t),
          n = (this.bl / s) * Math.sqrt((1 - this.es) / (1 - i * i));
        if ((n * n < 1 && (n = 1), isNaN(this.longc))) {
          var r = et(this.e, this.lat1, Math.sin(this.lat1)),
            o = et(this.e, this.lat2, Math.sin(this.lat2));
          this.lat0 >= 0
            ? (this.el = (n + Math.sqrt(n * n - 1)) * Math.pow(e, this.bl))
            : (this.el = (n - Math.sqrt(n * n - 1)) * Math.pow(e, this.bl));
          var l = Math.pow(r, this.bl),
            M = Math.pow(o, this.bl);
          h = 0.5 * ((a = this.el / l) - 1 / a);
          var c = (this.el * this.el - M * l) / (this.el * this.el + M * l),
            u = (M - l) / (M + l),
            f = ht(this.long1 - this.long2);
          (this.long0 =
            0.5 * (this.long1 + this.long2) -
            Math.atan((c * Math.tan(0.5 * this.bl * f)) / u) / this.bl),
            (this.long0 = ht(this.long0));
          var p = ht(this.long1 - this.long0);
          (this.gamma0 = Math.atan(Math.sin(this.bl * p) / h)),
            (this.alpha = Math.asin(n * Math.sin(this.gamma0)));
        } else
          (a =
            this.lat0 >= 0
              ? n + Math.sqrt(n * n - 1)
              : n - Math.sqrt(n * n - 1)),
            (this.el = a * Math.pow(e, this.bl)),
            (h = 0.5 * (a - 1 / a)),
            (this.gamma0 = Math.asin(Math.sin(this.alpha) / n)),
            (this.long0 =
              this.longc - Math.asin(h * Math.tan(this.gamma0)) / this.bl);
        this.no_off
          ? (this.uc = 0)
          : this.lat0 >= 0
            ? (this.uc =
                (this.al / this.bl) *
                Math.atan2(Math.sqrt(n * n - 1), Math.cos(this.alpha)))
            : (this.uc =
                ((-1 * this.al) / this.bl) *
                Math.atan2(Math.sqrt(n * n - 1), Math.cos(this.alpha)));
      },
      forward: function (t) {
        var s,
          i,
          a,
          h = t.x,
          e = t.y,
          n = ht(h - this.long0);
        if (Math.abs(Math.abs(e) - O) <= L)
          (a = e > 0 ? -1 : 1),
            (i =
              (this.al / this.bl) *
              Math.log(Math.tan(D + a * this.gamma0 * 0.5))),
            (s = (-1 * a * O * this.al) / this.bl);
        else {
          var r = et(this.e, e, Math.sin(e)),
            o = this.el / Math.pow(r, this.bl),
            l = 0.5 * (o - 1 / o),
            M = 0.5 * (o + 1 / o),
            c = Math.sin(this.bl * n),
            u = (l * Math.sin(this.gamma0) - c * Math.cos(this.gamma0)) / M;
          (i =
            Math.abs(Math.abs(u) - 1) <= L
              ? Number.POSITIVE_INFINITY
              : (0.5 * this.al * Math.log((1 - u) / (1 + u))) / this.bl),
            (s =
              Math.abs(Math.cos(this.bl * n)) <= L
                ? this.al * this.bl * n
                : (this.al *
                    Math.atan2(
                      l * Math.cos(this.gamma0) + c * Math.sin(this.gamma0),
                      Math.cos(this.bl * n),
                    )) /
                  this.bl);
        }
        return (
          this.no_rot
            ? ((t.x = this.x0 + s), (t.y = this.y0 + i))
            : ((s -= this.uc),
              (t.x =
                this.x0 + i * Math.cos(this.alpha) + s * Math.sin(this.alpha)),
              (t.y =
                this.y0 + s * Math.cos(this.alpha) - i * Math.sin(this.alpha))),
          t
        );
      },
      inverse: function (t) {
        var s, i;
        this.no_rot
          ? ((i = t.y - this.y0), (s = t.x - this.x0))
          : ((i =
              (t.x - this.x0) * Math.cos(this.alpha) -
              (t.y - this.y0) * Math.sin(this.alpha)),
            (s =
              (t.y - this.y0) * Math.cos(this.alpha) +
              (t.x - this.x0) * Math.sin(this.alpha)),
            (s += this.uc));
        var a = Math.exp((-1 * this.bl * i) / this.al),
          h = 0.5 * (a - 1 / a),
          e = 0.5 * (a + 1 / a),
          n = Math.sin((this.bl * s) / this.al),
          r = (n * Math.cos(this.gamma0) + h * Math.sin(this.gamma0)) / e,
          o = Math.pow(this.el / Math.sqrt((1 + r) / (1 - r)), 1 / this.bl);
        return (
          Math.abs(r - 1) < L
            ? ((t.x = this.long0), (t.y = O))
            : Math.abs(r + 1) < L
              ? ((t.x = this.long0), (t.y = -1 * O))
              : ((t.y = nt(this.e, o)),
                (t.x = ht(
                  this.long0 -
                    Math.atan2(
                      h * Math.cos(this.gamma0) - n * Math.sin(this.gamma0),
                      Math.cos((this.bl * s) / this.al),
                    ) /
                      this.bl,
                ))),
          t
        );
      },
      names: [
        "Hotine_Oblique_Mercator",
        "Hotine Oblique Mercator",
        "Hotine_Oblique_Mercator_Azimuth_Natural_Origin",
        "Hotine_Oblique_Mercator_Azimuth_Center",
        "omerc",
      ],
    },
    Vt = {
      init: function () {
        if (
          (this.lat2 || (this.lat2 = this.lat1),
          this.k0 || (this.k0 = 1),
          (this.x0 = this.x0 || 0),
          (this.y0 = this.y0 || 0),
          !(Math.abs(this.lat1 + this.lat2) < L))
        ) {
          var t = this.b / this.a;
          this.e = Math.sqrt(1 - t * t);
          var s = Math.sin(this.lat1),
            i = Math.cos(this.lat1),
            a = it(this.e, s, i),
            h = et(this.e, this.lat1, s),
            e = Math.sin(this.lat2),
            n = Math.cos(this.lat2),
            r = it(this.e, e, n),
            o = et(this.e, this.lat2, e),
            l = et(this.e, this.lat0, Math.sin(this.lat0));
          Math.abs(this.lat1 - this.lat2) > L
            ? (this.ns = Math.log(a / r) / Math.log(h / o))
            : (this.ns = s),
            isNaN(this.ns) && (this.ns = s),
            (this.f0 = a / (this.ns * Math.pow(h, this.ns))),
            (this.rh = this.a * this.f0 * Math.pow(l, this.ns)),
            this.title || (this.title = "Lambert Conformal Conic");
        }
      },
      forward: function (t) {
        var s = t.x,
          i = t.y;
        Math.abs(2 * Math.abs(i) - Math.PI) <= L && (i = at(i) * (O - 2 * L));
        var a,
          h,
          e = Math.abs(Math.abs(i) - O);
        if (e > L)
          (a = et(this.e, i, Math.sin(i))),
            (h = this.a * this.f0 * Math.pow(a, this.ns));
        else {
          if ((e = i * this.ns) <= 0) return null;
          h = 0;
        }
        var n = this.ns * ht(s - this.long0);
        return (
          (t.x = this.k0 * (h * Math.sin(n)) + this.x0),
          (t.y = this.k0 * (this.rh - h * Math.cos(n)) + this.y0),
          t
        );
      },
      inverse: function (t) {
        var s,
          i,
          a,
          h,
          e,
          n = (t.x - this.x0) / this.k0,
          r = this.rh - (t.y - this.y0) / this.k0;
        this.ns > 0
          ? ((s = Math.sqrt(n * n + r * r)), (i = 1))
          : ((s = -Math.sqrt(n * n + r * r)), (i = -1));
        var o = 0;
        if (
          (0 !== s && (o = Math.atan2(i * n, i * r)), 0 !== s || this.ns > 0)
        ) {
          if (
            ((i = 1 / this.ns),
            (a = Math.pow(s / (this.a * this.f0), i)),
            -9999 === (h = nt(this.e, a)))
          )
            return null;
        } else h = -O;
        return (e = ht(o / this.ns + this.long0)), (t.x = e), (t.y = h), t;
      },
      names: [
        "Lambert Tangential Conformal Conic Projection",
        "Lambert_Conformal_Conic",
        "Lambert_Conformal_Conic_2SP",
        "lcc",
      ],
    },
    Zt = {
      init: function () {
        (this.a = 6377397.155),
          (this.es = 0.006674372230614),
          (this.e = Math.sqrt(this.es)),
          this.lat0 || (this.lat0 = 0.863937979737193),
          this.long0 || (this.long0 = 0.4334234309119251),
          this.k0 || (this.k0 = 0.9999),
          (this.s45 = 0.785398163397448),
          (this.s90 = 2 * this.s45),
          (this.fi0 = this.lat0),
          (this.e2 = this.es),
          (this.e = Math.sqrt(this.e2)),
          (this.alfa = Math.sqrt(
            1 + (this.e2 * Math.pow(Math.cos(this.fi0), 4)) / (1 - this.e2),
          )),
          (this.uq = 1.04216856380474),
          (this.u0 = Math.asin(Math.sin(this.fi0) / this.alfa)),
          (this.g = Math.pow(
            (1 + this.e * Math.sin(this.fi0)) /
              (1 - this.e * Math.sin(this.fi0)),
            (this.alfa * this.e) / 2,
          )),
          (this.k =
            (Math.tan(this.u0 / 2 + this.s45) /
              Math.pow(Math.tan(this.fi0 / 2 + this.s45), this.alfa)) *
            this.g),
          (this.k1 = this.k0),
          (this.n0 =
            (this.a * Math.sqrt(1 - this.e2)) /
            (1 - this.e2 * Math.pow(Math.sin(this.fi0), 2))),
          (this.s0 = 1.37008346281555),
          (this.n = Math.sin(this.s0)),
          (this.ro0 = (this.k1 * this.n0) / Math.tan(this.s0)),
          (this.ad = this.s90 - this.uq);
      },
      forward: function (t) {
        var s,
          i,
          a,
          h,
          e,
          n,
          r,
          o = t.x,
          l = t.y,
          M = ht(o - this.long0);
        return (
          (s = Math.pow(
            (1 + this.e * Math.sin(l)) / (1 - this.e * Math.sin(l)),
            (this.alfa * this.e) / 2,
          )),
          (i =
            2 *
            (Math.atan(
              (this.k * Math.pow(Math.tan(l / 2 + this.s45), this.alfa)) / s,
            ) -
              this.s45)),
          (a = -M * this.alfa),
          (h = Math.asin(
            Math.cos(this.ad) * Math.sin(i) +
              Math.sin(this.ad) * Math.cos(i) * Math.cos(a),
          )),
          (e = Math.asin((Math.cos(i) * Math.sin(a)) / Math.cos(h))),
          (n = this.n * e),
          (r =
            (this.ro0 * Math.pow(Math.tan(this.s0 / 2 + this.s45), this.n)) /
            Math.pow(Math.tan(h / 2 + this.s45), this.n)),
          (t.y = (r * Math.cos(n)) / 1),
          (t.x = (r * Math.sin(n)) / 1),
          this.czech || ((t.y *= -1), (t.x *= -1)),
          t
        );
      },
      inverse: function (t) {
        var s,
          i,
          a,
          h,
          e,
          n,
          r,
          o = t.x;
        (t.x = t.y),
          (t.y = o),
          this.czech || ((t.y *= -1), (t.x *= -1)),
          (e = Math.sqrt(t.x * t.x + t.y * t.y)),
          (h = Math.atan2(t.y, t.x) / Math.sin(this.s0)),
          (a =
            2 *
            (Math.atan(
              Math.pow(this.ro0 / e, 1 / this.n) *
                Math.tan(this.s0 / 2 + this.s45),
            ) -
              this.s45)),
          (s = Math.asin(
            Math.cos(this.ad) * Math.sin(a) -
              Math.sin(this.ad) * Math.cos(a) * Math.cos(h),
          )),
          (i = Math.asin((Math.cos(a) * Math.sin(h)) / Math.cos(s))),
          (t.x = this.long0 - i / this.alfa),
          (n = s),
          (r = 0);
        var l = 0;
        do {
          (t.y =
            2 *
            (Math.atan(
              Math.pow(this.k, -1 / this.alfa) *
                Math.pow(Math.tan(s / 2 + this.s45), 1 / this.alfa) *
                Math.pow(
                  (1 + this.e * Math.sin(n)) / (1 - this.e * Math.sin(n)),
                  this.e / 2,
                ),
            ) -
              this.s45)),
            Math.abs(n - t.y) < 1e-10 && (r = 1),
            (n = t.y),
            (l += 1);
        } while (0 === r && l < 15);
        return l >= 15 ? null : t;
      },
      names: ["Krovak", "krovak"],
    },
    Yt = function (t, s, i, a, h) {
      return (
        t * h - s * Math.sin(2 * h) + i * Math.sin(4 * h) - a * Math.sin(6 * h)
      );
    },
    $t = function (t) {
      return 1 - 0.25 * t * (1 + (t / 16) * (3 + 1.25 * t));
    },
    ts = function (t) {
      return 0.375 * t * (1 + 0.25 * t * (1 + 0.46875 * t));
    },
    ss = function (t) {
      return 0.05859375 * t * t * (1 + 0.75 * t);
    },
    is = function (t) {
      return t * t * t * (35 / 3072);
    },
    as = function (t, s, i) {
      var a = s * i;
      return t / Math.sqrt(1 - a * a);
    },
    hs = function (t) {
      return Math.abs(t) < O ? t : t - at(t) * Math.PI;
    },
    es = function (t, s, i, a, h) {
      var e, n;
      e = t / s;
      for (var r = 0; r < 15; r++)
        if (
          ((e += n =
            (t -
              (s * e -
                i * Math.sin(2 * e) +
                a * Math.sin(4 * e) -
                h * Math.sin(6 * e))) /
            (s -
              2 * i * Math.cos(2 * e) +
              4 * a * Math.cos(4 * e) -
              6 * h * Math.cos(6 * e))),
          Math.abs(n) <= 1e-10)
        )
          return e;
      return NaN;
    },
    ns = {
      init: function () {
        this.sphere ||
          ((this.e0 = $t(this.es)),
          (this.e1 = ts(this.es)),
          (this.e2 = ss(this.es)),
          (this.e3 = is(this.es)),
          (this.ml0 =
            this.a * Yt(this.e0, this.e1, this.e2, this.e3, this.lat0)));
      },
      forward: function (t) {
        var s,
          i,
          a = t.x,
          h = t.y;
        if (((a = ht(a - this.long0)), this.sphere))
          (s = this.a * Math.asin(Math.cos(h) * Math.sin(a))),
            (i = this.a * (Math.atan2(Math.tan(h), Math.cos(a)) - this.lat0));
        else {
          var e = Math.sin(h),
            n = Math.cos(h),
            r = as(this.a, this.e, e),
            o = Math.tan(h) * Math.tan(h),
            l = a * Math.cos(h),
            M = l * l,
            c = (this.es * n * n) / (1 - this.es);
          (s = r * l * (1 - M * o * (1 / 6 - ((8 - o + 8 * c) * M) / 120))),
            (i =
              this.a * Yt(this.e0, this.e1, this.e2, this.e3, h) -
              this.ml0 +
              ((r * e) / n) * M * (0.5 + ((5 - o + 6 * c) * M) / 24));
        }
        return (t.x = s + this.x0), (t.y = i + this.y0), t;
      },
      inverse: function (t) {
        (t.x -= this.x0), (t.y -= this.y0);
        var s,
          i,
          a = t.x / this.a,
          h = t.y / this.a;
        if (this.sphere) {
          var e = h + this.lat0;
          (s = Math.asin(Math.sin(e) * Math.cos(a))),
            (i = Math.atan2(Math.tan(a), Math.cos(e)));
        } else {
          var n = this.ml0 / this.a + h,
            r = es(n, this.e0, this.e1, this.e2, this.e3);
          if (Math.abs(Math.abs(r) - O) <= L)
            return (t.x = this.long0), (t.y = O), h < 0 && (t.y *= -1), t;
          var o = as(this.a, this.e, Math.sin(r)),
            l = ((o * o * o) / this.a / this.a) * (1 - this.es),
            M = Math.pow(Math.tan(r), 2),
            c = (a * this.a) / o,
            u = c * c;
          (s =
            r -
            ((o * Math.tan(r)) / l) *
              c *
              c *
              (0.5 - ((1 + 3 * M) * c * c) / 24)),
            (i =
              (c * (1 - u * (M / 3 + ((1 + 3 * M) * M * u) / 15))) /
              Math.cos(r));
        }
        return (t.x = ht(i + this.long0)), (t.y = hs(s)), t;
      },
      names: ["Cassini", "Cassini_Soldner", "cass"],
    },
    rs = function (t, s) {
      var i;
      return t > 1e-7
        ? (1 - t * t) *
            (s / (1 - (i = t * s) * i) -
              (0.5 / t) * Math.log((1 - i) / (1 + i)))
        : 2 * s;
    },
    os = 0.3333333333333333,
    ls = 0.17222222222222222,
    Ms = 0.10257936507936508,
    cs = 0.06388888888888888,
    us = 0.0664021164021164,
    fs = 0.016415012942191543,
    ps = {
      init: function () {
        var t,
          s = Math.abs(this.lat0);
        if (
          (Math.abs(s - O) < L
            ? (this.mode = this.lat0 < 0 ? this.S_POLE : this.N_POLE)
            : Math.abs(s) < L
              ? (this.mode = this.EQUIT)
              : (this.mode = this.OBLIQ),
          this.es > 0)
        )
          switch (
            ((this.qp = rs(this.e, 1)),
            (this.mmf = 0.5 / (1 - this.es)),
            (this.apa = (function (t) {
              var s,
                i = [];
              return (
                (i[0] = t * os),
                (s = t * t),
                (i[0] += s * ls),
                (i[1] = s * cs),
                (s *= t),
                (i[0] += s * Ms),
                (i[1] += s * us),
                (i[2] = s * fs),
                i
              );
            })(this.es)),
            this.mode)
          ) {
            case this.N_POLE:
            case this.S_POLE:
              this.dd = 1;
              break;
            case this.EQUIT:
              (this.rq = Math.sqrt(0.5 * this.qp)),
                (this.dd = 1 / this.rq),
                (this.xmf = 1),
                (this.ymf = 0.5 * this.qp);
              break;
            case this.OBLIQ:
              (this.rq = Math.sqrt(0.5 * this.qp)),
                (t = Math.sin(this.lat0)),
                (this.sinb1 = rs(this.e, t) / this.qp),
                (this.cosb1 = Math.sqrt(1 - this.sinb1 * this.sinb1)),
                (this.dd =
                  Math.cos(this.lat0) /
                  (Math.sqrt(1 - this.es * t * t) * this.rq * this.cosb1)),
                (this.ymf = (this.xmf = this.rq) / this.dd),
                (this.xmf *= this.dd);
          }
        else
          this.mode === this.OBLIQ &&
            ((this.sinph0 = Math.sin(this.lat0)),
            (this.cosph0 = Math.cos(this.lat0)));
      },
      forward: function (t) {
        var s,
          i,
          a,
          h,
          e,
          n,
          r,
          o,
          l,
          M,
          c = t.x,
          u = t.y;
        if (((c = ht(c - this.long0)), this.sphere)) {
          if (
            ((e = Math.sin(u)),
            (M = Math.cos(u)),
            (a = Math.cos(c)),
            this.mode === this.OBLIQ || this.mode === this.EQUIT)
          ) {
            if (
              (i =
                this.mode === this.EQUIT
                  ? 1 + M * a
                  : 1 + this.sinph0 * e + this.cosph0 * M * a) <= L
            )
              return null;
            (s = (i = Math.sqrt(2 / i)) * M * Math.sin(c)),
              (i *=
                this.mode === this.EQUIT
                  ? e
                  : this.cosph0 * e - this.sinph0 * M * a);
          } else if (this.mode === this.N_POLE || this.mode === this.S_POLE) {
            if (
              (this.mode === this.N_POLE && (a = -a),
              Math.abs(u + this.phi0) < L)
            )
              return null;
            (i = D - 0.5 * u),
              (s =
                (i =
                  2 * (this.mode === this.S_POLE ? Math.cos(i) : Math.sin(i))) *
                Math.sin(c)),
              (i *= a);
          }
        } else {
          switch (
            ((r = 0),
            (o = 0),
            (l = 0),
            (a = Math.cos(c)),
            (h = Math.sin(c)),
            (e = Math.sin(u)),
            (n = rs(this.e, e)),
            (this.mode !== this.OBLIQ && this.mode !== this.EQUIT) ||
              ((r = n / this.qp), (o = Math.sqrt(1 - r * r))),
            this.mode)
          ) {
            case this.OBLIQ:
              l = 1 + this.sinb1 * r + this.cosb1 * o * a;
              break;
            case this.EQUIT:
              l = 1 + o * a;
              break;
            case this.N_POLE:
              (l = O + u), (n = this.qp - n);
              break;
            case this.S_POLE:
              (l = u - O), (n = this.qp + n);
          }
          if (Math.abs(l) < L) return null;
          switch (this.mode) {
            case this.OBLIQ:
            case this.EQUIT:
              (l = Math.sqrt(2 / l)),
                (i =
                  this.mode === this.OBLIQ
                    ? this.ymf * l * (this.cosb1 * r - this.sinb1 * o * a)
                    : (l = Math.sqrt(2 / (1 + o * a))) * r * this.ymf),
                (s = this.xmf * l * o * h);
              break;
            case this.N_POLE:
            case this.S_POLE:
              n >= 0
                ? ((s = (l = Math.sqrt(n)) * h),
                  (i = a * (this.mode === this.S_POLE ? l : -l)))
                : (s = i = 0);
          }
        }
        return (t.x = this.a * s + this.x0), (t.y = this.a * i + this.y0), t;
      },
      inverse: function (t) {
        (t.x -= this.x0), (t.y -= this.y0);
        var s,
          i,
          a,
          h,
          e,
          n,
          r,
          o = t.x / this.a,
          l = t.y / this.a;
        if (this.sphere) {
          var M,
            c = 0,
            u = 0;
          if ((i = 0.5 * (M = Math.sqrt(o * o + l * l))) > 1) return null;
          switch (
            ((i = 2 * Math.asin(i)),
            (this.mode !== this.OBLIQ && this.mode !== this.EQUIT) ||
              ((u = Math.sin(i)), (c = Math.cos(i))),
            this.mode)
          ) {
            case this.EQUIT:
              (i = Math.abs(M) <= L ? 0 : Math.asin((l * u) / M)),
                (o *= u),
                (l = c * M);
              break;
            case this.OBLIQ:
              (i =
                Math.abs(M) <= L
                  ? this.phi0
                  : Math.asin(c * this.sinph0 + (l * u * this.cosph0) / M)),
                (o *= u * this.cosph0),
                (l = (c - Math.sin(i) * this.sinph0) * M);
              break;
            case this.N_POLE:
              (l = -l), (i = O - i);
              break;
            case this.S_POLE:
              i -= O;
          }
          s =
            0 !== l || (this.mode !== this.EQUIT && this.mode !== this.OBLIQ)
              ? Math.atan2(o, l)
              : 0;
        } else {
          if (((r = 0), this.mode === this.OBLIQ || this.mode === this.EQUIT)) {
            if (
              ((o /= this.dd),
              (l *= this.dd),
              (n = Math.sqrt(o * o + l * l)) < L)
            )
              return (t.x = 0), (t.y = this.phi0), t;
            (h = 2 * Math.asin((0.5 * n) / this.rq)),
              (a = Math.cos(h)),
              (o *= h = Math.sin(h)),
              this.mode === this.OBLIQ
                ? ((r = a * this.sinb1 + (l * h * this.cosb1) / n),
                  (e = this.qp * r),
                  (l = n * this.cosb1 * a - l * this.sinb1 * h))
                : ((r = (l * h) / n), (e = this.qp * r), (l = n * a));
          } else if (this.mode === this.N_POLE || this.mode === this.S_POLE) {
            if ((this.mode === this.N_POLE && (l = -l), !(e = o * o + l * l)))
              return (t.x = 0), (t.y = this.phi0), t;
            (r = 1 - e / this.qp), this.mode === this.S_POLE && (r = -r);
          }
          (s = Math.atan2(o, l)),
            (i = (function (t, s) {
              var i = t + t;
              return (
                t +
                s[0] * Math.sin(i) +
                s[1] * Math.sin(i + i) +
                s[2] * Math.sin(i + i + i)
              );
            })(Math.asin(r), this.apa));
        }
        return (t.x = ht(this.long0 + s)), (t.y = i), t;
      },
      names: [
        "Lambert Azimuthal Equal Area",
        "Lambert_Azimuthal_Equal_Area",
        "laea",
      ],
      S_POLE: 1,
      N_POLE: 2,
      EQUIT: 3,
      OBLIQ: 4,
    },
    ms = function (t) {
      return Math.abs(t) > 1 && (t = t > 1 ? 1 : -1), Math.asin(t);
    },
    ds = {
      init: function () {
        Math.abs(this.lat1 + this.lat2) < L ||
          ((this.temp = this.b / this.a),
          (this.es = 1 - Math.pow(this.temp, 2)),
          (this.e3 = Math.sqrt(this.es)),
          (this.sin_po = Math.sin(this.lat1)),
          (this.cos_po = Math.cos(this.lat1)),
          (this.t1 = this.sin_po),
          (this.con = this.sin_po),
          (this.ms1 = it(this.e3, this.sin_po, this.cos_po)),
          (this.qs1 = rs(this.e3, this.sin_po, this.cos_po)),
          (this.sin_po = Math.sin(this.lat2)),
          (this.cos_po = Math.cos(this.lat2)),
          (this.t2 = this.sin_po),
          (this.ms2 = it(this.e3, this.sin_po, this.cos_po)),
          (this.qs2 = rs(this.e3, this.sin_po, this.cos_po)),
          (this.sin_po = Math.sin(this.lat0)),
          (this.cos_po = Math.cos(this.lat0)),
          (this.t3 = this.sin_po),
          (this.qs0 = rs(this.e3, this.sin_po, this.cos_po)),
          Math.abs(this.lat1 - this.lat2) > L
            ? (this.ns0 =
                (this.ms1 * this.ms1 - this.ms2 * this.ms2) /
                (this.qs2 - this.qs1))
            : (this.ns0 = this.con),
          (this.c = this.ms1 * this.ms1 + this.ns0 * this.qs1),
          (this.rh =
            (this.a * Math.sqrt(this.c - this.ns0 * this.qs0)) / this.ns0));
      },
      forward: function (t) {
        var s = t.x,
          i = t.y;
        (this.sin_phi = Math.sin(i)), (this.cos_phi = Math.cos(i));
        var a = rs(this.e3, this.sin_phi, this.cos_phi),
          h = (this.a * Math.sqrt(this.c - this.ns0 * a)) / this.ns0,
          e = this.ns0 * ht(s - this.long0),
          n = h * Math.sin(e) + this.x0,
          r = this.rh - h * Math.cos(e) + this.y0;
        return (t.x = n), (t.y = r), t;
      },
      inverse: function (t) {
        var s, i, a, h, e, n;
        return (
          (t.x -= this.x0),
          (t.y = this.rh - t.y + this.y0),
          this.ns0 >= 0
            ? ((s = Math.sqrt(t.x * t.x + t.y * t.y)), (a = 1))
            : ((s = -Math.sqrt(t.x * t.x + t.y * t.y)), (a = -1)),
          (h = 0),
          0 !== s && (h = Math.atan2(a * t.x, a * t.y)),
          (a = (s * this.ns0) / this.a),
          this.sphere
            ? (n = Math.asin((this.c - a * a) / (2 * this.ns0)))
            : ((i = (this.c - a * a) / this.ns0), (n = this.phi1z(this.e3, i))),
          (e = ht(h / this.ns0 + this.long0)),
          (t.x = e),
          (t.y = n),
          t
        );
      },
      names: ["Albers_Conic_Equal_Area", "Albers", "aea"],
      phi1z: function (t, s) {
        var i,
          a,
          h,
          e,
          n = ms(0.5 * s);
        if (t < L) return n;
        for (var r = t * t, o = 1; o <= 25; o++)
          if (
            ((n += e =
              ((0.5 * (h = 1 - (a = t * (i = Math.sin(n))) * a) * h) /
                Math.cos(n)) *
              (s / (1 - r) - i / h + (0.5 / t) * Math.log((1 - a) / (1 + a)))),
            Math.abs(e) <= 1e-7)
          )
            return n;
        return null;
      },
    },
    ys = {
      init: function () {
        (this.sin_p14 = Math.sin(this.lat0)),
          (this.cos_p14 = Math.cos(this.lat0)),
          (this.infinity_dist = 1e3 * this.a),
          (this.rc = 1);
      },
      forward: function (t) {
        var s,
          i,
          a,
          h,
          e,
          n,
          r,
          o = t.x,
          l = t.y;
        return (
          (a = ht(o - this.long0)),
          (s = Math.sin(l)),
          (i = Math.cos(l)),
          (h = Math.cos(a)),
          1,
          (e = this.sin_p14 * s + this.cos_p14 * i * h) > 0 || Math.abs(e) <= L
            ? ((n = this.x0 + (1 * this.a * i * Math.sin(a)) / e),
              (r =
                this.y0 +
                (1 * this.a * (this.cos_p14 * s - this.sin_p14 * i * h)) / e))
            : ((n = this.x0 + this.infinity_dist * i * Math.sin(a)),
              (r =
                this.y0 +
                this.infinity_dist *
                  (this.cos_p14 * s - this.sin_p14 * i * h))),
          (t.x = n),
          (t.y = r),
          t
        );
      },
      inverse: function (t) {
        var s, i, a, h, e, n;
        return (
          (t.x = (t.x - this.x0) / this.a),
          (t.y = (t.y - this.y0) / this.a),
          (t.x /= this.k0),
          (t.y /= this.k0),
          (s = Math.sqrt(t.x * t.x + t.y * t.y))
            ? ((h = Math.atan2(s, this.rc)),
              (i = Math.sin(h)),
              (a = Math.cos(h)),
              (n = ms(a * this.sin_p14 + (t.y * i * this.cos_p14) / s)),
              (e = Math.atan2(
                t.x * i,
                s * this.cos_p14 * a - t.y * this.sin_p14 * i,
              )),
              (e = ht(this.long0 + e)))
            : ((n = this.phic0), (e = 0)),
          (t.x = e),
          (t.y = n),
          t
        );
      },
      names: ["gnom"],
    },
    _s = function (t, s) {
      var i = 1 - ((1 - t * t) / (2 * t)) * Math.log((1 - t) / (1 + t));
      if (Math.abs(Math.abs(s) - i) < 1e-6) return s < 0 ? -1 * O : O;
      for (var a, h, e, n, r = Math.asin(0.5 * s), o = 0; o < 30; o++)
        if (
          ((h = Math.sin(r)),
          (e = Math.cos(r)),
          (n = t * h),
          (r += a =
            (Math.pow(1 - n * n, 2) / (2 * e)) *
            (s / (1 - t * t) -
              h / (1 - n * n) +
              (0.5 / t) * Math.log((1 - n) / (1 + n)))),
          Math.abs(a) <= 1e-10)
        )
          return r;
      return NaN;
    },
    xs = {
      init: function () {
        this.sphere ||
          (this.k0 = it(this.e, Math.sin(this.lat_ts), Math.cos(this.lat_ts)));
      },
      forward: function (t) {
        var s,
          i,
          a = t.x,
          h = t.y,
          e = ht(a - this.long0);
        if (this.sphere)
          (s = this.x0 + this.a * e * Math.cos(this.lat_ts)),
            (i = this.y0 + (this.a * Math.sin(h)) / Math.cos(this.lat_ts));
        else {
          var n = rs(this.e, Math.sin(h));
          (s = this.x0 + this.a * this.k0 * e),
            (i = this.y0 + (this.a * n * 0.5) / this.k0);
        }
        return (t.x = s), (t.y = i), t;
      },
      inverse: function (t) {
        var s, i;
        return (
          (t.x -= this.x0),
          (t.y -= this.y0),
          this.sphere
            ? ((s = ht(this.long0 + t.x / this.a / Math.cos(this.lat_ts))),
              (i = Math.asin((t.y / this.a) * Math.cos(this.lat_ts))))
            : ((i = _s(this.e, (2 * t.y * this.k0) / this.a)),
              (s = ht(this.long0 + t.x / (this.a * this.k0)))),
          (t.x = s),
          (t.y = i),
          t
        );
      },
      names: ["cea"],
    },
    gs = {
      init: function () {
        (this.x0 = this.x0 || 0),
          (this.y0 = this.y0 || 0),
          (this.lat0 = this.lat0 || 0),
          (this.long0 = this.long0 || 0),
          (this.lat_ts = this.lat_ts || 0),
          (this.title = this.title || "Equidistant Cylindrical (Plate Carre)"),
          (this.rc = Math.cos(this.lat_ts));
      },
      forward: function (t) {
        var s = t.x,
          i = t.y,
          a = ht(s - this.long0),
          h = hs(i - this.lat0);
        return (
          (t.x = this.x0 + this.a * a * this.rc),
          (t.y = this.y0 + this.a * h),
          t
        );
      },
      inverse: function (t) {
        var s = t.x,
          i = t.y;
        return (
          (t.x = ht(this.long0 + (s - this.x0) / (this.a * this.rc))),
          (t.y = hs(this.lat0 + (i - this.y0) / this.a)),
          t
        );
      },
      names: ["Equirectangular", "Equidistant_Cylindrical", "eqc"],
    },
    bs = 20,
    vs = {
      init: function () {
        (this.temp = this.b / this.a),
          (this.es = 1 - Math.pow(this.temp, 2)),
          (this.e = Math.sqrt(this.es)),
          (this.e0 = $t(this.es)),
          (this.e1 = ts(this.es)),
          (this.e2 = ss(this.es)),
          (this.e3 = is(this.es)),
          (this.ml0 =
            this.a * Yt(this.e0, this.e1, this.e2, this.e3, this.lat0));
      },
      forward: function (t) {
        var s,
          i,
          a,
          h = t.x,
          e = t.y,
          n = ht(h - this.long0);
        if (((a = n * Math.sin(e)), this.sphere))
          Math.abs(e) <= L
            ? ((s = this.a * n), (i = -1 * this.a * this.lat0))
            : ((s = (this.a * Math.sin(a)) / Math.tan(e)),
              (i =
                this.a *
                (hs(e - this.lat0) + (1 - Math.cos(a)) / Math.tan(e))));
        else if (Math.abs(e) <= L) (s = this.a * n), (i = -1 * this.ml0);
        else {
          var r = as(this.a, this.e, Math.sin(e)) / Math.tan(e);
          (s = r * Math.sin(a)),
            (i =
              this.a * Yt(this.e0, this.e1, this.e2, this.e3, e) -
              this.ml0 +
              r * (1 - Math.cos(a)));
        }
        return (t.x = s + this.x0), (t.y = i + this.y0), t;
      },
      inverse: function (t) {
        var s, i, a, h, e, n, r, o, l;
        if (((a = t.x - this.x0), (h = t.y - this.y0), this.sphere))
          if (Math.abs(h + this.a * this.lat0) <= L)
            (s = ht(a / this.a + this.long0)), (i = 0);
          else {
            var M;
            for (
              n = this.lat0 + h / this.a,
                r = (a * a) / this.a / this.a + n * n,
                o = n,
                e = bs;
              e;
              --e
            )
              if (
                ((o += l =
                  (-1 *
                    (n * (o * (M = Math.tan(o)) + 1) -
                      o -
                      0.5 * (o * o + r) * M)) /
                  ((o - n) / M - 1)),
                Math.abs(l) <= L)
              ) {
                i = o;
                break;
              }
            s = ht(
              this.long0 + Math.asin((a * Math.tan(o)) / this.a) / Math.sin(i),
            );
          }
        else if (Math.abs(h + this.ml0) <= L)
          (i = 0), (s = ht(this.long0 + a / this.a));
        else {
          var c, u, f, p, m;
          for (
            n = (this.ml0 + h) / this.a,
              r = (a * a) / this.a / this.a + n * n,
              o = n,
              e = bs;
            e;
            --e
          )
            if (
              ((m = this.e * Math.sin(o)),
              (c = Math.sqrt(1 - m * m) * Math.tan(o)),
              (u = this.a * Yt(this.e0, this.e1, this.e2, this.e3, o)),
              (f =
                this.e0 -
                2 * this.e1 * Math.cos(2 * o) +
                4 * this.e2 * Math.cos(4 * o) -
                6 * this.e3 * Math.cos(6 * o)),
              (o -= l =
                (n * (c * (p = u / this.a) + 1) - p - 0.5 * c * (p * p + r)) /
                ((this.es * Math.sin(2 * o) * (p * p + r - 2 * n * p)) /
                  (4 * c) +
                  (n - p) * (c * f - 2 / Math.sin(2 * o)) -
                  f)),
              Math.abs(l) <= L)
            ) {
              i = o;
              break;
            }
          (c = Math.sqrt(1 - this.es * Math.pow(Math.sin(i), 2)) * Math.tan(i)),
            (s = ht(this.long0 + Math.asin((a * c) / this.a) / Math.sin(i)));
        }
        return (t.x = s), (t.y = i), t;
      },
      names: ["Polyconic", "poly"],
    },
    ws = {
      init: function () {
        (this.A = []),
          (this.A[1] = 0.6399175073),
          (this.A[2] = -0.1358797613),
          (this.A[3] = 0.063294409),
          (this.A[4] = -0.02526853),
          (this.A[5] = 0.0117879),
          (this.A[6] = -0.0055161),
          (this.A[7] = 0.0026906),
          (this.A[8] = -0.001333),
          (this.A[9] = 67e-5),
          (this.A[10] = -34e-5),
          (this.B_re = []),
          (this.B_im = []),
          (this.B_re[1] = 0.7557853228),
          (this.B_im[1] = 0),
          (this.B_re[2] = 0.249204646),
          (this.B_im[2] = 0.003371507),
          (this.B_re[3] = -0.001541739),
          (this.B_im[3] = 0.04105856),
          (this.B_re[4] = -0.10162907),
          (this.B_im[4] = 0.01727609),
          (this.B_re[5] = -0.26623489),
          (this.B_im[5] = -0.36249218),
          (this.B_re[6] = -0.6870983),
          (this.B_im[6] = -1.1651967),
          (this.C_re = []),
          (this.C_im = []),
          (this.C_re[1] = 1.3231270439),
          (this.C_im[1] = 0),
          (this.C_re[2] = -0.577245789),
          (this.C_im[2] = -0.007809598),
          (this.C_re[3] = 0.508307513),
          (this.C_im[3] = -0.112208952),
          (this.C_re[4] = -0.15094762),
          (this.C_im[4] = 0.18200602),
          (this.C_re[5] = 1.01418179),
          (this.C_im[5] = 1.64497696),
          (this.C_re[6] = 1.9660549),
          (this.C_im[6] = 2.5127645),
          (this.D = []),
          (this.D[1] = 1.5627014243),
          (this.D[2] = 0.5185406398),
          (this.D[3] = -0.03333098),
          (this.D[4] = -0.1052906),
          (this.D[5] = -0.0368594),
          (this.D[6] = 0.007317),
          (this.D[7] = 0.0122),
          (this.D[8] = 0.00394),
          (this.D[9] = -0.0013);
      },
      forward: function (t) {
        var s,
          i = t.x,
          a = t.y - this.lat0,
          h = i - this.long0,
          e = (a / A) * 1e-5,
          n = h,
          r = 1,
          o = 0;
        for (s = 1; s <= 10; s++) (r *= e), (o += this.A[s] * r);
        var l,
          M = o,
          c = n,
          u = 1,
          f = 0,
          p = 0,
          m = 0;
        for (s = 1; s <= 6; s++)
          (l = f * M + u * c),
            (u = u * M - f * c),
            (f = l),
            (p = p + this.B_re[s] * u - this.B_im[s] * f),
            (m = m + this.B_im[s] * u + this.B_re[s] * f);
        return (t.x = m * this.a + this.x0), (t.y = p * this.a + this.y0), t;
      },
      inverse: function (t) {
        var s,
          i,
          a = t.x,
          h = t.y,
          e = a - this.x0,
          n = (h - this.y0) / this.a,
          r = e / this.a,
          o = 1,
          l = 0,
          M = 0,
          c = 0;
        for (s = 1; s <= 6; s++)
          (i = l * n + o * r),
            (o = o * n - l * r),
            (l = i),
            (M = M + this.C_re[s] * o - this.C_im[s] * l),
            (c = c + this.C_im[s] * o + this.C_re[s] * l);
        for (var u = 0; u < this.iterations; u++) {
          var f,
            p = M,
            m = c,
            d = n,
            y = r;
          for (s = 2; s <= 6; s++)
            (f = m * M + p * c),
              (p = p * M - m * c),
              (m = f),
              (d += (s - 1) * (this.B_re[s] * p - this.B_im[s] * m)),
              (y += (s - 1) * (this.B_im[s] * p + this.B_re[s] * m));
          (p = 1), (m = 0);
          var _ = this.B_re[1],
            x = this.B_im[1];
          for (s = 2; s <= 6; s++)
            (f = m * M + p * c),
              (p = p * M - m * c),
              (m = f),
              (_ += s * (this.B_re[s] * p - this.B_im[s] * m)),
              (x += s * (this.B_im[s] * p + this.B_re[s] * m));
          var g = _ * _ + x * x;
          (M = (d * _ + y * x) / g), (c = (y * _ - d * x) / g);
        }
        var b = M,
          v = c,
          w = 1,
          C = 0;
        for (s = 1; s <= 9; s++) (w *= b), (C += this.D[s] * w);
        var P = this.lat0 + C * A * 1e5,
          N = this.long0 + v;
        return (t.x = N), (t.y = P), t;
      },
      names: ["New_Zealand_Map_Grid", "nzmg"],
    },
    Cs = {
      init: function () {},
      forward: function (t) {
        var s = t.x,
          i = t.y,
          a = ht(s - this.long0),
          h = this.x0 + this.a * a,
          e =
            this.y0 + this.a * Math.log(Math.tan(Math.PI / 4 + i / 2.5)) * 1.25;
        return (t.x = h), (t.y = e), t;
      },
      inverse: function (t) {
        (t.x -= this.x0), (t.y -= this.y0);
        var s = ht(this.long0 + t.x / this.a),
          i = 2.5 * (Math.atan(Math.exp((0.8 * t.y) / this.a)) - Math.PI / 4);
        return (t.x = s), (t.y = i), t;
      },
      names: ["Miller_Cylindrical", "mill"],
    },
    Ps = 20,
    Ns = {
      init: function () {
        this.sphere
          ? ((this.n = 1),
            (this.m = 0),
            (this.es = 0),
            (this.C_y = Math.sqrt((this.m + 1) / this.n)),
            (this.C_x = this.C_y / (this.m + 1)))
          : (this.en = qt(this.es));
      },
      forward: function (t) {
        var s,
          i,
          a = t.x,
          h = t.y;
        if (((a = ht(a - this.long0)), this.sphere)) {
          if (this.m)
            for (var e = this.n * Math.sin(h), n = Ps; n; --n) {
              var r = (this.m * h + Math.sin(h) - e) / (this.m + Math.cos(h));
              if (((h -= r), Math.abs(r) < L)) break;
            }
          else h = 1 !== this.n ? Math.asin(this.n * Math.sin(h)) : h;
          (s = this.a * this.C_x * a * (this.m + Math.cos(h))),
            (i = this.a * this.C_y * h);
        } else {
          var o = Math.sin(h),
            l = Math.cos(h);
          (i = this.a * It(h, o, l, this.en)),
            (s = (this.a * a * l) / Math.sqrt(1 - this.es * o * o));
        }
        return (t.x = s), (t.y = i), t;
      },
      inverse: function (t) {
        var s, i, a, h;
        return (
          (t.x -= this.x0),
          (a = t.x / this.a),
          (t.y -= this.y0),
          (s = t.y / this.a),
          this.sphere
            ? ((s /= this.C_y),
              (a /= this.C_x * (this.m + Math.cos(s))),
              this.m
                ? (s = ms((this.m * s + Math.sin(s)) / this.n))
                : 1 !== this.n && (s = ms(Math.sin(s) / this.n)),
              (a = ht(a + this.long0)),
              (s = hs(s)))
            : ((s = At(t.y / this.a, this.es, this.en)),
              (h = Math.abs(s)) < O
                ? ((h = Math.sin(s)),
                  (i =
                    this.long0 +
                    (t.x * Math.sqrt(1 - this.es * h * h)) /
                      (this.a * Math.cos(s))),
                  (a = ht(i)))
                : h - L < O && (a = this.long0)),
          (t.x = a),
          (t.y = s),
          t
        );
      },
      names: ["Sinusoidal", "sinu"],
    },
    Ss = {
      init: function () {},
      forward: function (t) {
        for (
          var s = t.x,
            i = t.y,
            a = ht(s - this.long0),
            h = i,
            e = Math.PI * Math.sin(i),
            n = 0;
          ;
          n++
        ) {
          var r = -(h + Math.sin(h) - e) / (1 + Math.cos(h));
          if (((h += r), Math.abs(r) < L)) break;
        }
        (h /= 2), Math.PI / 2 - Math.abs(i) < L && (a = 0);
        var o = 0.900316316158 * this.a * a * Math.cos(h) + this.x0,
          l = 1.4142135623731 * this.a * Math.sin(h) + this.y0;
        return (t.x = o), (t.y = l), t;
      },
      inverse: function (t) {
        var s, i;
        (t.x -= this.x0),
          (t.y -= this.y0),
          (i = t.y / (1.4142135623731 * this.a)),
          Math.abs(i) > 0.999999999999 && (i = 0.999999999999),
          (s = Math.asin(i));
        var a = ht(this.long0 + t.x / (0.900316316158 * this.a * Math.cos(s)));
        a < -Math.PI && (a = -Math.PI),
          a > Math.PI && (a = Math.PI),
          (i = (2 * s + Math.sin(2 * s)) / Math.PI),
          Math.abs(i) > 1 && (i = 1);
        var h = Math.asin(i);
        return (t.x = a), (t.y = h), t;
      },
      names: ["Mollweide", "moll"],
    },
    ks = {
      init: function () {
        Math.abs(this.lat1 + this.lat2) < L ||
          ((this.lat2 = this.lat2 || this.lat1),
          (this.temp = this.b / this.a),
          (this.es = 1 - Math.pow(this.temp, 2)),
          (this.e = Math.sqrt(this.es)),
          (this.e0 = $t(this.es)),
          (this.e1 = ts(this.es)),
          (this.e2 = ss(this.es)),
          (this.e3 = is(this.es)),
          (this.sinphi = Math.sin(this.lat1)),
          (this.cosphi = Math.cos(this.lat1)),
          (this.ms1 = it(this.e, this.sinphi, this.cosphi)),
          (this.ml1 = Yt(this.e0, this.e1, this.e2, this.e3, this.lat1)),
          Math.abs(this.lat1 - this.lat2) < L
            ? (this.ns = this.sinphi)
            : ((this.sinphi = Math.sin(this.lat2)),
              (this.cosphi = Math.cos(this.lat2)),
              (this.ms2 = it(this.e, this.sinphi, this.cosphi)),
              (this.ml2 = Yt(this.e0, this.e1, this.e2, this.e3, this.lat2)),
              (this.ns = (this.ms1 - this.ms2) / (this.ml2 - this.ml1))),
          (this.g = this.ml1 + this.ms1 / this.ns),
          (this.ml0 = Yt(this.e0, this.e1, this.e2, this.e3, this.lat0)),
          (this.rh = this.a * (this.g - this.ml0)));
      },
      forward: function (t) {
        var s,
          i = t.x,
          a = t.y;
        if (this.sphere) s = this.a * (this.g - a);
        else {
          var h = Yt(this.e0, this.e1, this.e2, this.e3, a);
          s = this.a * (this.g - h);
        }
        var e = this.ns * ht(i - this.long0),
          n = this.x0 + s * Math.sin(e),
          r = this.y0 + this.rh - s * Math.cos(e);
        return (t.x = n), (t.y = r), t;
      },
      inverse: function (t) {
        var s, i, a, h;
        (t.x -= this.x0),
          (t.y = this.rh - t.y + this.y0),
          this.ns >= 0
            ? ((i = Math.sqrt(t.x * t.x + t.y * t.y)), (s = 1))
            : ((i = -Math.sqrt(t.x * t.x + t.y * t.y)), (s = -1));
        var e = 0;
        if ((0 !== i && (e = Math.atan2(s * t.x, s * t.y)), this.sphere))
          return (
            (h = ht(this.long0 + e / this.ns)),
            (a = hs(this.g - i / this.a)),
            (t.x = h),
            (t.y = a),
            t
          );
        var n = this.g - i / this.a;
        return (
          (a = es(n, this.e0, this.e1, this.e2, this.e3)),
          (h = ht(this.long0 + e / this.ns)),
          (t.x = h),
          (t.y = a),
          t
        );
      },
      names: ["Equidistant_Conic", "eqdc"],
    },
    Es = {
      init: function () {
        this.R = this.a;
      },
      forward: function (t) {
        var s,
          i,
          a = t.x,
          h = t.y,
          e = ht(a - this.long0);
        Math.abs(h) <= L && ((s = this.x0 + this.R * e), (i = this.y0));
        var n = ms(2 * Math.abs(h / Math.PI));
        (Math.abs(e) <= L || Math.abs(Math.abs(h) - O) <= L) &&
          ((s = this.x0),
          (i =
            h >= 0
              ? this.y0 + Math.PI * this.R * Math.tan(0.5 * n)
              : this.y0 + Math.PI * this.R * -Math.tan(0.5 * n)));
        var r = 0.5 * Math.abs(Math.PI / e - e / Math.PI),
          o = r * r,
          l = Math.sin(n),
          M = Math.cos(n),
          c = M / (l + M - 1),
          u = c * c,
          f = c * (2 / l - 1),
          p = f * f,
          m =
            (Math.PI *
              this.R *
              (r * (c - p) +
                Math.sqrt(o * (c - p) * (c - p) - (p + o) * (u - p)))) /
            (p + o);
        e < 0 && (m = -m), (s = this.x0 + m);
        var d = o + c;
        return (
          (m =
            (Math.PI *
              this.R *
              (f * d - r * Math.sqrt((p + o) * (o + 1) - d * d))) /
            (p + o)),
          (i = h >= 0 ? this.y0 + m : this.y0 - m),
          (t.x = s),
          (t.y = i),
          t
        );
      },
      inverse: function (t) {
        var s, i, a, h, e, n, r, o, l, M, c, u;
        return (
          (t.x -= this.x0),
          (t.y -= this.y0),
          (c = Math.PI * this.R),
          (e = (a = t.x / c) * a + (h = t.y / c) * h),
          (c =
            (3 *
              ((h * h) /
                (o =
                  -2 * (n = -Math.abs(h) * (1 + e)) + 1 + 2 * h * h + e * e) +
                ((2 * (r = n - 2 * h * h + a * a) * r * r) / o / o / o -
                  (9 * n * r) / o / o) /
                  27)) /
            (l = (n - (r * r) / 3 / o) / o) /
            (M = 2 * Math.sqrt(-l / 3))),
          Math.abs(c) > 1 && (c = c >= 0 ? 1 : -1),
          (u = Math.acos(c) / 3),
          (i =
            t.y >= 0
              ? (-M * Math.cos(u + Math.PI / 3) - r / 3 / o) * Math.PI
              : -(-M * Math.cos(u + Math.PI / 3) - r / 3 / o) * Math.PI),
          (s =
            Math.abs(a) < L
              ? this.long0
              : ht(
                  this.long0 +
                    (Math.PI *
                      (e - 1 + Math.sqrt(1 + 2 * (a * a - h * h) + e * e))) /
                      2 /
                      a,
                )),
          (t.x = s),
          (t.y = i),
          t
        );
      },
      names: ["Van_der_Grinten_I", "VanDerGrinten", "vandg"],
    },
    qs = {
      init: function () {
        (this.sin_p12 = Math.sin(this.lat0)),
          (this.cos_p12 = Math.cos(this.lat0));
      },
      forward: function (t) {
        var s,
          i,
          a,
          h,
          e,
          n,
          r,
          o,
          l,
          M,
          c,
          u,
          f,
          p,
          m,
          d,
          y,
          _,
          x,
          g,
          b,
          v,
          w = t.x,
          C = t.y,
          P = Math.sin(t.y),
          N = Math.cos(t.y),
          S = ht(w - this.long0);
        return this.sphere
          ? Math.abs(this.sin_p12 - 1) <= L
            ? ((t.x = this.x0 + this.a * (O - C) * Math.sin(S)),
              (t.y = this.y0 - this.a * (O - C) * Math.cos(S)),
              t)
            : Math.abs(this.sin_p12 + 1) <= L
              ? ((t.x = this.x0 + this.a * (O + C) * Math.sin(S)),
                (t.y = this.y0 + this.a * (O + C) * Math.cos(S)),
                t)
              : ((_ = this.sin_p12 * P + this.cos_p12 * N * Math.cos(S)),
                (y = (d = Math.acos(_)) / Math.sin(d)),
                (t.x = this.x0 + this.a * y * N * Math.sin(S)),
                (t.y =
                  this.y0 +
                  this.a *
                    y *
                    (this.cos_p12 * P - this.sin_p12 * N * Math.cos(S))),
                t)
          : ((s = $t(this.es)),
            (i = ts(this.es)),
            (a = ss(this.es)),
            (h = is(this.es)),
            Math.abs(this.sin_p12 - 1) <= L
              ? ((e = this.a * Yt(s, i, a, h, O)),
                (n = this.a * Yt(s, i, a, h, C)),
                (t.x = this.x0 + (e - n) * Math.sin(S)),
                (t.y = this.y0 - (e - n) * Math.cos(S)),
                t)
              : Math.abs(this.sin_p12 + 1) <= L
                ? ((e = this.a * Yt(s, i, a, h, O)),
                  (n = this.a * Yt(s, i, a, h, C)),
                  (t.x = this.x0 + (e + n) * Math.sin(S)),
                  (t.y = this.y0 + (e + n) * Math.cos(S)),
                  t)
                : ((r = P / N),
                  (o = as(this.a, this.e, this.sin_p12)),
                  (l = as(this.a, this.e, P)),
                  (M = Math.atan(
                    (1 - this.es) * r + (this.es * o * this.sin_p12) / (l * N),
                  )),
                  (x =
                    0 ===
                    (c = Math.atan2(
                      Math.sin(S),
                      this.cos_p12 * Math.tan(M) - this.sin_p12 * Math.cos(S),
                    ))
                      ? Math.asin(
                          this.cos_p12 * Math.sin(M) -
                            this.sin_p12 * Math.cos(M),
                        )
                      : Math.abs(Math.abs(c) - Math.PI) <= L
                        ? -Math.asin(
                            this.cos_p12 * Math.sin(M) -
                              this.sin_p12 * Math.cos(M),
                          )
                        : Math.asin((Math.sin(S) * Math.cos(M)) / Math.sin(c))),
                  (u = (this.e * this.sin_p12) / Math.sqrt(1 - this.es)),
                  (d =
                    o *
                    x *
                    (1 -
                      ((g = x * x) *
                        (m =
                          (f =
                            (this.e * this.cos_p12 * Math.cos(c)) /
                            Math.sqrt(1 - this.es)) * f) *
                        (1 - m)) /
                        6 +
                      ((b = g * x) / 8) * (p = u * f) * (1 - 2 * m) +
                      ((v = b * x) / 120) *
                        (m * (4 - 7 * m) - 3 * u * u * (1 - 7 * m)) -
                      ((v * x) / 48) * p)),
                  (t.x = this.x0 + d * Math.sin(c)),
                  (t.y = this.y0 + d * Math.cos(c)),
                  t));
      },
      inverse: function (t) {
        var s, i, a, h, e, n, r, o, l, M, c, u, f, p, m, d, y, _, x, g, b, v;
        if (((t.x -= this.x0), (t.y -= this.y0), this.sphere)) {
          if ((s = Math.sqrt(t.x * t.x + t.y * t.y)) > 2 * O * this.a) return;
          return (
            (i = s / this.a),
            (a = Math.sin(i)),
            (h = Math.cos(i)),
            (e = this.long0),
            Math.abs(s) <= L
              ? (n = this.lat0)
              : ((n = ms(h * this.sin_p12 + (t.y * a * this.cos_p12) / s)),
                (r = Math.abs(this.lat0) - O),
                (e = ht(
                  Math.abs(r) <= L
                    ? this.lat0 >= 0
                      ? this.long0 + Math.atan2(t.x, -t.y)
                      : this.long0 - Math.atan2(-t.x, t.y)
                    : this.long0 +
                        Math.atan2(
                          t.x * a,
                          s * this.cos_p12 * h - t.y * this.sin_p12 * a,
                        ),
                ))),
            (t.x = e),
            (t.y = n),
            t
          );
        }
        return (
          (o = $t(this.es)),
          (l = ts(this.es)),
          (M = ss(this.es)),
          (c = is(this.es)),
          Math.abs(this.sin_p12 - 1) <= L
            ? ((u = this.a * Yt(o, l, M, c, O)),
              (s = Math.sqrt(t.x * t.x + t.y * t.y)),
              (n = es((u - s) / this.a, o, l, M, c)),
              (e = ht(this.long0 + Math.atan2(t.x, -1 * t.y))),
              (t.x = e),
              (t.y = n),
              t)
            : Math.abs(this.sin_p12 + 1) <= L
              ? ((u = this.a * Yt(o, l, M, c, O)),
                (s = Math.sqrt(t.x * t.x + t.y * t.y)),
                (n = es((s - u) / this.a, o, l, M, c)),
                (e = ht(this.long0 + Math.atan2(t.x, t.y))),
                (t.x = e),
                (t.y = n),
                t)
              : ((s = Math.sqrt(t.x * t.x + t.y * t.y)),
                (m = Math.atan2(t.x, t.y)),
                (f = as(this.a, this.e, this.sin_p12)),
                (d = Math.cos(m)),
                (_ = (-(y = this.e * this.cos_p12 * d) * y) / (1 - this.es)),
                (x =
                  (3 * this.es * (1 - _) * this.sin_p12 * this.cos_p12 * d) /
                  (1 - this.es)),
                (v =
                  1 -
                  (_ *
                    (b =
                      (g = s / f) -
                      (_ * (1 + _) * Math.pow(g, 3)) / 6 -
                      (x * (1 + 3 * _) * Math.pow(g, 4)) / 24) *
                    b) /
                    2 -
                  (g * b * b * b) / 6),
                (p = Math.asin(
                  this.sin_p12 * Math.cos(b) + this.cos_p12 * Math.sin(b) * d,
                )),
                (e = ht(
                  this.long0 +
                    Math.asin((Math.sin(m) * Math.sin(b)) / Math.cos(p)),
                )),
                (n = Math.atan(
                  ((1 - (this.es * v * this.sin_p12) / Math.sin(p)) *
                    Math.tan(p)) /
                    (1 - this.es),
                )),
                (t.x = e),
                (t.y = n),
                t)
        );
      },
      names: ["Azimuthal_Equidistant", "aeqd"],
    },
    Is = {
      init: function () {
        (this.sin_p14 = Math.sin(this.lat0)),
          (this.cos_p14 = Math.cos(this.lat0));
      },
      forward: function (t) {
        var s,
          i,
          a,
          h,
          e,
          n,
          r,
          o = t.x,
          l = t.y;
        return (
          (a = ht(o - this.long0)),
          (s = Math.sin(l)),
          (i = Math.cos(l)),
          (h = Math.cos(a)),
          1,
          ((e = this.sin_p14 * s + this.cos_p14 * i * h) > 0 ||
            Math.abs(e) <= L) &&
            ((n = 1 * this.a * i * Math.sin(a)),
            (r =
              this.y0 +
              1 * this.a * (this.cos_p14 * s - this.sin_p14 * i * h))),
          (t.x = n),
          (t.y = r),
          t
        );
      },
      inverse: function (t) {
        var s, i, a, h, e, n, r;
        return (
          (t.x -= this.x0),
          (t.y -= this.y0),
          (s = Math.sqrt(t.x * t.x + t.y * t.y)),
          (i = ms(s / this.a)),
          (a = Math.sin(i)),
          (h = Math.cos(i)),
          (n = this.long0),
          Math.abs(s) <= L
            ? ((r = this.lat0), (t.x = n), (t.y = r), t)
            : ((r = ms(h * this.sin_p14 + (t.y * a * this.cos_p14) / s)),
              (e = Math.abs(this.lat0) - O),
              Math.abs(e) <= L
                ? ((n = ht(
                    this.lat0 >= 0
                      ? this.long0 + Math.atan2(t.x, -t.y)
                      : this.long0 - Math.atan2(-t.x, t.y),
                  )),
                  (t.x = n),
                  (t.y = r),
                  t)
                : ((n = ht(
                    this.long0 +
                      Math.atan2(
                        t.x * a,
                        s * this.cos_p14 * h - t.y * this.sin_p14 * a,
                      ),
                  )),
                  (t.x = n),
                  (t.y = r),
                  t))
        );
      },
      names: ["ortho"],
    };
  return (
    (y.defaultDatum = "WGS84"),
    (y.Proj = u),
    (y.WGS84 = new y.Proj("WGS84")),
    (y.Point = S),
    (y.toPoint = dt),
    (y.defs = o),
    (y.transform = p),
    (y.mgrs = Nt),
    (y.version = "2.4.3"),
    (St = y).Proj.projections.add(Ot),
    St.Proj.projections.add(Dt),
    St.Proj.projections.add(Ut),
    St.Proj.projections.add(Ht),
    St.Proj.projections.add(Xt),
    St.Proj.projections.add(Jt),
    St.Proj.projections.add(Kt),
    St.Proj.projections.add(Vt),
    St.Proj.projections.add(Zt),
    St.Proj.projections.add(ns),
    St.Proj.projections.add(ps),
    St.Proj.projections.add(ds),
    St.Proj.projections.add(ys),
    St.Proj.projections.add(xs),
    St.Proj.projections.add(gs),
    St.Proj.projections.add(vs),
    St.Proj.projections.add(ws),
    St.Proj.projections.add(Cs),
    St.Proj.projections.add(Ns),
    St.Proj.projections.add(Ss),
    St.Proj.projections.add(ks),
    St.Proj.projections.add(Es),
    St.Proj.projections.add(qs),
    St.Proj.projections.add(Is),
    y
  );
});
